PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Wed Oct 29, 2025 3:47 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jan 03, 2014 4:16 pm 
Offline

Joined: Fri Jan 03, 2014 4:10 pm
Posts: 3
I am a new user with Migradoc. I was using pdfsharp but found that it was much easier to have automatic page breaks inserted if what was being inserted was too long for one page. Now that I can get it to go on to the next page, I now need to be able to control when that page break happens. The output is a string consisting of formatted blocks of text separated by line breaks.

I am going to break the string up into a list of strings and then have it put each string in sequence onto the PDF. I would like it to be able to insert a page break if the next string will not fit on the current page. I haven't written any real code for it yet. I am understanding that there is a way to use XGraphics.measurestring() to get the dimensions of the string and then can possibly use that to compare to the size of the PDF page but I am pretty lost.


Thank you, in advanced, for any assistance


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 13, 2014 10:06 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Hi!

When using MigraDoc as intended, you do not have to mess around with MeasureString.

With MigraDoc, add each block as a paragraph. Mark this paragraph as KeepTogether. PageBreaks will occur before or after this paragraph, but not inside that paragraph.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 27, 2014 8:55 pm 
Offline

Joined: Fri Jan 03, 2014 4:10 pm
Posts: 3
Thank you so much for the help, that was exactly what I am looking for!


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 103 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