PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 26, 2018 9:39 am

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri May 08, 2009 6:14 pm 

Joined: Wed May 06, 2009 2:22 pm
Posts: 2
I started by creating a document using PdfDocument but now realise that i need to incorporate the Document object as I need to create paragraphs that will automatically go on to another page when a page is filled. However, I have a slight problem. I create my sections using various methods and then use documentRenderer to format the document as shown below:

MigraDoc.Rendering.DocumentRenderer docR = new DocumentRenderer(doc);

if (docR.FormattedDocument.PageCount > 0)
int pageCount = docR.FormattedDocument.PageCount;

for (int i = 1; i < pageCount + 1; i++)
PdfPage newpage = document.AddPage();
newpage.Height = XUnit.FromCentimeter(29.7).Point;
newpage.Width = XUnit.FromCentimeter(21.5).Point;
gfx = XGraphics.FromPdfPage(newpage);
docR.RenderPage(gfx, i);

However, for some reason the sections are appearing on seperate pages instead of one after the other. Does anyone know why this is happening?

Reply with quote  
 Post subject:
PostPosted: Mon May 11, 2009 8:28 am 
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2811
Location: Cologne, Germany
IIRC sections always start on a new page - they allow you to set a different page size etc.

If you don't want page breaks, just use one section with many paragraphs.
And you can add page breaks (if needed) within a section.

Thomas Hoevel
PDFsharp Team

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

All times are UTC

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 10 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:  
Powered by phpBB® Forum Software © phpBB Group