PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed May 15, 2024 10:09 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Nov 17, 2009 8:45 pm 
Offline

Joined: Tue Nov 17, 2009 8:24 pm
Posts: 9
How can I specify leading as well as font size? Typically I have font size of 9 and leading of 11 on my reports. Next most common is font size 8 and leading of 10.

I'm not a typographic expert, but I think it means something like this:
(font size 9, leading 11): The font size is 9, but the vertical spacing from line to line is like the font size were 11.

Thanks,
Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 18, 2009 12:42 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
In MigraDoc you simple set the font size to 9 and the line spacing to exactly 11 or to at least 11.

Code:
Style style = document.Styles["Test"];
style.Font.Size = 9;
style.ParagraphFormat.LineSpacing = 11;
style.ParagraphFormat.LineSpacingRule = LineSpacingRule.AtLeast;

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 18, 2009 1:07 pm 
Offline

Joined: Tue Nov 17, 2009 8:24 pm
Posts: 9
Thank you very much. I see that I did not state my output is PDF. So, if I build my report in MigraDoc, can I readily transform that to a PDF file?

Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 18, 2009 1:33 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
Yes.

With PDFsharp, line spacing (and leading) is to be controlled by you.

MigraDoc creates PDF. Just check the HelloWorld and HelloMigraDoc samples.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 19, 2009 12:31 am 
Offline

Joined: Tue Nov 17, 2009 8:24 pm
Posts: 9
Thanks, I'll check those out.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 14, 2009 5:19 pm 
Offline

Joined: Tue Nov 17, 2009 8:24 pm
Posts: 9
I tried this, but it does not seem to make any difference.

doc.Styles.AddStyle("nine11", "Normal");
Style sty911b = doc.Styles["nine11"];
sty911b.Font.Size = 9;
sty911b.ParagraphFormat.LineSpacing = 11;
sty911b.ParagraphFormat.LineSpacingRule = LineSpacingRule.AtLeast;
sty911b.Font.Bold = true;

par.AddFormattedText(" " + s, sty911b.Font);

If I use LineSpacing = 9; or = 11; or = 21; or anything else, the PDF I render is exactly the same.
What am I missing?

Thanks, Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 16, 2009 8:54 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 340
JonJacobs wrote:
par.AddFormattedText(" " + s, sty911b.Font);

With that call, you're not setting the paragraph style of the paragraph - therefore the linespacing of the style has no effect.

Try
Code:
par.Style = "nine11";

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 48 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group