Hello.
I am very new to both PDFsharp as well as MigraDoc. I have recently been working on a project generating pdf forms, and a coworker of mine recommended MigraDoc. The issue that I have been dealing with the last day or two is an alignment issue with a border. The purpose of the border(s) is to to act as a wall separating two different tables, I assume just for aesthetic reasons. For some reason, the borders (and only these borders) are all shifted slightly to the right, making the whole thing look somewhat goofy. I have attached a picture of the code that I am using for the borders, as well as a picture of the output I have been getting. I guess I will also include the code in this message.
Note: the following code is the same format that I have been using for all of the borders, they all just use different names for the paragraph and border objects.
Code:
//Border #1
double height = (1.0);
MigraDoc.DocumentObjectModel.Color hrFillColor = new MigraDoc.DocumentObjectModel.Color(0, 0, 0); //.Color(250, 250, 250, 250);
Color hrBorderColor = new Color(0, 0, 0);
Paragraph p = mainSection.AddParagraph();
Border newBorder = new Border {Style = BorderStyle.Single, Color = hrBorderColor};
p.Format = new ParagraphFormat
{
Alignment = ParagraphAlignment.Center,
Font = new Font("Courier New", new Unit(height)),
Shading = new Shading { Visible = true, Color = hrFillColor },
SpaceAfter = 0,
Borders = new Borders
{
Bottom = newBorder,
Left = newBorder.Clone(),
Right = newBorder.Clone(),
Top = newBorder.Clone()
}
};
I have tried multiple different things, including changing the alignment to Left and going back through to make sure all the paragraph alignments prior were set to Center, and that the mainsection's alignment is set to Center. I have also tried my best to look through this forum pretty carefully, and I just can not find a solution. Please help me lol, once again I am only a day or two into learning this stuff and I apologize if my question is silly or if my code is bad.