Can I create a new pdf document pasting a cut area on it?

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Can I create a new pdf document pasting a cut area on it?

Post by relapse »

Hello!

I have a new question: I crop (cut) an area on a pdf document via setting new values of the CropBox. It's actually nothing else as defining a new visible area. Now I'd like to enlarge the cropped area with a white space of a specific size but so that no other objects on the document are visible. It's possible by enlarging the CropBox if no other objects are near the originally cropped area. My suppose is to copy the visible area and extract it onto a new larger document. Is it possible?



Thanks for your replies!
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Can I create a new pdf document pasting a cut area on it

Post by John - Tracker Supp »

Please advise which of our products you are using ...
Thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: Can I create a new pdf document pasting a cut area on it

Post by relapse »

PDF-XChange PRO 4 SDK
and
PDF-XChange Viewer SDK


P.S.: I meant it properly this way: I'd like to find out the way I can copy a currently visible area (say, 6x10 cm) and place it centered on a new PDF page (9x13 cm) so that I'll have a free white space around my original object.

What I've found in the documentation is the method PXCp_PlaceContents that "overlays content from the specified page(s) of an Adobe PDF document source document as background or foreground content on the specified page(s) of a destination Adobe PDF document", but I see no possibility there to determine the exact area (of certain coordinates) to be copied onto the other document.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17822
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Can I create a new pdf document pasting a cut area on it

Post by Tracker Supp-Stefan »

Hi Relapse,

We just discussed this problem with a colleague of mine, and here are the comments we have:

In theory it's possible to achieve exactly the desired result, but only with the Low Level API, and with extensive knowledge of the PDF format.

An alternative solution that will produce similar result is the following sequence:
1. Crop the original page(s)
2. Create Blank page(s) large enough to accomodate (cropped size+ margins + some extra space)
3. Place cropped page(s) in the center(s) of the Blank one(s)
4. Crop result to get the desired margins (this is why we may need some extra space in step 2).

Of course the result will not be a perfect solution since actually the original content will still be present - invisible, but PDF editing programs may still extract it.

This is achievable with both the High and Low level methods, and while the low level ones might produce a faster application such a solution will be slower to implement. If you go the Low level way - you will need the correct MediaBox/CropBox to get the required page size and add the cropping rectangle before adding the content.

Best,
Stefan
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: Can I create a new pdf document pasting a cut area on it

Post by relapse »

Is that alternative solution based on using of the PXCp_PlaceContents()?
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Can I create a new pdf document pasting a cut area on it

Post by Lzcat - Tracker Supp »

Yes.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: Can I create a new pdf document pasting a cut area on it

Post by relapse »

OK, I'll try that approach. Thanks for your fast reply!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17822
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Can I create a new pdf document pasting a cut area on it

Post by Tracker Supp-Stefan »

Our pleasure Relapse! :)
Post Reply