PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:48 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: Sun Feb 21, 2016 10:40 am 
Offline

Joined: Sun Feb 21, 2016 10:08 am
Posts: 2
Hi PDFsharp Team,
first of all, great library. I've found it a few days ago, it works really well and simple to use! Great work!

I've the following use case I try to solve with PDFsharp (in C#). Basically its about cropping a section of a XPdfForm element.
I have a given PDF that includes various content. There are two areas in this PDF I try to isolate, and copy them into a new smaller PDF.

See the following visualization. This is the structure of the original PDF document. I try to isolate the red and green area:

Image

The final PDF should look like:

Image

Reading through the examples I think the basic way to go should be use

Code:
// Read from original PDF
XPdfForm form = XPdfForm.FromFile(fileFullPath);
// TODO Isolate the required area
// paste into the target PDF
XGraphics gfx.DrawImage(form, new XRect(0, 0, form.PointWidth, form.PointHeight));


That would require that I can isolate a certain section in the XPdfForm or while pasting it via XGraphics into the target PDF. Is that possible?
If not, do you think it could work if I create two temporary PDFs, each with the dimension of the area to be isolated, and make proper use of the transform (rotate etc) of the XPdfForm or XGraphics object, and then create a final pdf out of these two?
Or is there any other way to achive this (e.g. convert the XPdfForm or XGraphics object in an image or something similar)?

Thank you a lot for your help or advice!

Joerg


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 26, 2016 7:59 am 
Offline

Joined: Sun Feb 21, 2016 10:08 am
Posts: 2
For everyone who runs into the same problem, I have been able to solve this in working with temporary PDFs that isolate the separate elements and then create a final PDF.
You have to make proper use of the PDFs sizes, form and gfx classes and functions of course.


Top
 Profile  
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: Google [Bot] and 137 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