i'm working at a small app that wold allow to copy a frame (for example a rectangular selection) from a page to a page of an other documents, like the snapshot function of adobe reader. It is possible?
I've tried to use the 'xObject' like that:
XObject xpage = original.Pages_.ToXObject(doc);
but it works on full-page only…
Thank to everybody for any advise!_
your requirement can be satisfied by PDF Clown, but there's no off-the-shelf function to use at the moment: you have to scan the page contents (through ContentScanner class ) evaluating their positions on the page, then you have to clone the relevant contents to the target page along the referenced resources, taking care to adjust the target graphics state in order to reproduce the same graphic parameters.
Yes, I understand it's not an easy task if you have no PDF spec knowledge, but I assure you it's absolutely feasible.
Thank you Stefano,
is there any examples that use ContentScanner from a PDF document?
You can find lots of code samples inside the downloadable distribution, just go to the clown.samples.cli project and search for "ContentScanner" occurrences.
This class allows you to navigate across an existing content stream examining its contents (see getCurrent() method) and graphics state (see getState() method), adding new contents and removing existing ones. Content objects are described by a dedicated package .
I'm trying to do something similar. The basic idea is cropping a pdf page, that is creating a new pdf page containing only what is included in a rectangular selection of the first pdf page (more or less). I've moved back and forth through the pdfclown library and sample. I succeded in using ContentScanner and navigating through objects, but what is not clear to me is the way of cloning a content (different from an entire page) or adding/removing contents. Probably my PDF knowledge is still not so specific...
Thanks for any suggestion/hint
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.