| PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
| Determine If String Too Long For Page https://forum.pdfsharp.net/viewtopic.php?f=2&t=2700 |
Page 1 of 1 |
| Author: | sparko10 [ Fri Jan 03, 2014 4:16 pm ] |
| Post subject: | Determine If String Too Long For Page |
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 |
|
| Author: | Thomas Hoevel [ Mon Jan 13, 2014 10:06 am ] |
| Post subject: | Re: Determine If String Too Long For Page |
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. |
|
| Author: | sparko10 [ Mon Jan 27, 2014 8:55 pm ] |
| Post subject: | Re: Determine If String Too Long For Page |
Thank you so much for the help, that was exactly what I am looking for! |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|