PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Jul 16, 2024 4:05 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Nov 09, 2011 6:58 am 
Offline

Joined: Wed Nov 09, 2011 6:43 am
Posts: 1
I have to modify an existing PDF Document.
First i'm importing the PDF.
Than i Draw an Image somewhere.
Last i save it again.

Code ist simple an small.

BUT: If I do this twice (Open, Modify, Write, Open, Modify, Write), the Second Image is not drawn on the right coordinates (same code as before!).
In the second run, the Image is drawn very small somewhere on the page.

I think, the first modification left some Transformation Code on the Page, witch is not terminated correctly.
Opening that doc again, PDFSharp don't know about that transformation, and fails to place the next image correctly.

My Code for drawing is like:
gfx.ScaleTransform(fak);
gfx.DrawImage(img, destRect);

These lines seems to fix the Problem:
...
gfx.Restore(state);
gfx.DrawLine(new XPen(XColors.White), new Point(-10, -10), new Point(-11, -10));
If I append them for the First run of my code, everything seems to run well.

But i'm afraid to get an PDF witch is not build from myselfe, with the same Problem.

So my question: After Importing an PDF, before extending an exisiting Page, is there any chance to append something to that page, that will
reset all aplied koordinate transformations, so that the first gfx.DrawImage will place the image where it would place it on an newly created, empty page?

Something Like ResetTransformation, but written directly to the PDF-Content?

Thanks for your help
Andreas


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

All times are UTC


Who is online

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