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:
The final PDF should look like:
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