PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 4:09 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jul 23, 2013 2:55 pm 
Offline

Joined: Tue Jul 23, 2013 2:34 pm
Posts: 2
Excuse me if I'm being thick (being a newbie).
I'm using PDFSharp in VB2010 Express to create a PDF file from a text file stream and some images.
I'm using gdx.DrawString and gdx.DrawImage
I increment my "Y" position for each line by the height of my font and, as expected everything looks fine.
Unfortunately, I'm having a problem when I want to use multiple pages.
I'm using the code:-
If (LocY + font.Height) > page.Height.Point Then
page = document.AddPage
LocY = 0
End If
to add a new page and reset my "Y" position when I have no more room on the page (this is within a loop for each line of text).
The saved PDF has the correct number of pages, but everything has been rendered onto the first page.
What am I doing wrong?


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 23, 2013 3:43 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
You have to create a new "gdx" (or "gfx") for every new page.
You create a new page - but the old gfx continues to draw on the old page.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 23, 2013 3:55 pm 
Offline

Joined: Tue Jul 23, 2013 2:34 pm
Posts: 2
Thanks for the speedy answer Thomas. All working brilliantly now :)


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: No registered users and 341 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group