I am creating a PDF using MigraDoc. Everything works fine except the setting of line spacing of a paragraph. I want to have more vertical space between paragraph lines.
What I tried so far without any change in the resulting PDF:
string text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
Paragraph para = CreateParagraph(text , "Helvetica", 7, "0.1mm", Colors.Black, ParagraphAlignment.Left);
// tried this:
para.Format.LineSpacing = MigraDoc.DocumentObjectModel.Unit.FromMillimeter(12);
// and tried that:
para.Format.LineSpacing = 12;
Can anyone point me in the right direction?
Line spacing determines the amount of vertical space between lines of text in a paragraph. By default, lines are single-spaced, meaning that the spacing accommodates the largest font in that line, plus a small amount of extra space. Paragraph spacing determines the amount of space above or below a paragraph.
It is false that, line spacing is the vertical space before and after a paragraph. There are two types of vertical spacing adjustments in most of recent word typing softwares (eg. MS Word). Those two types of vertical spacing are - 1) line spacing and 2) paragraph spacing.
The meaning of LineSpacing
depends on the value set for LineSpacingRule
.
If LineSpacingRule
is set to e.g. Single
or Double
then the value set for LineSpacing
will be ignored.
Try AtLeast
or Exactly
for LineSpacingRule
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With