PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

PdfSharp / MigraDoc help
http://forum.pdfsharp.de/viewtopic.php?f=2&t=419
Page 1 of 1

Author:  AViD [ Fri Jun 27, 2008 2:53 pm ]
Post subject:  PdfSharp / MigraDoc help

I am new to PdfSharp, but its busy driving me nuts. I have gone throught the forum and can't find ansers to my questions

Q1: Automatic Pagebreaks
If I understand it correctly, MigraDoc Lite can do that and PdfSharp cannot. Can someone please give me a simple example how to do this?

I just want to add paragraphs and images (both of which the count/length I don't know) and want the code to sort out the pagebreaks itself.

Q2: Wordwrap
If I add a paragraph/text to the the document/page I want it to automatically use carrige return. Can someone please show me how to do this? Is there a setting or technique?

Help would be much appreciated!
Andre

Author:  AViD [ Sat Jun 28, 2008 1:45 pm ]
Post subject: 

Well, I'll help myself then. This is for anyone else having the same problem.

I just used a Migradoc table. If a paragraph in a cell is too long, it will wrap it and start it on the next line.

As for the multiple pages, just continue adding stuff in cells and rows. Then do this after the renderer's PrepareDocument() method.

Code:
rend.PrepareDocument();
         
for(int i = 1; i <= rend.FormattedDocument.PageCount; i++)
{
   PdfPage page = doc.AddPage();         
   XGraphics gfx = XGraphics.FromPdfPage(page);
   rend.RenderPage(gfx,i);            
}


i = 1 because the numbering doesn't start at the conventional, but 1, which makes sense, sortoff.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/