Inserting pages from another document in a script

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

Post Reply
claude vidal
User
Posts: 138
Joined: Wed Mar 09, 2016 12:47 am

Inserting pages from another document in a script

Post by claude vidal »

I'm trying to add a page from another document (which has form fields) in the current document using the Acrobat API method 'insertPages' and this works well.

The problem occurs when I repeat this script more than once. The method has no provision to rename fields when inserting a page, so I end up with duplicate field names.

Is there any programmatic way to do this without producing duplicate field names?

P.S. I can't afford Tracker's SDK
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel »

i do know that using the insert pages function from the toolbars does this automatically, though i cant seem to call the exact function in a button myself. You could try looking into that method of doing so, but i would suggest just simply using the toolbar function as it already exists to serve that purpose.
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel »

I forgot to note, you do need to select the dropdown option, Copy with Rename for this method to work
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
claude vidal
User
Posts: 138
Joined: Wed Mar 09, 2016 12:47 am

Re: Inserting pages from another document in a script

Post by claude vidal »

TrackerSupp-Daniel wrote:i do know that using the insert pages function from the toolbars does this automatically, though i cant seem to call the exact function in a button myself. You could try looking into that method of doing so, but i would suggest just simply using the toolbar function as it already exists to serve that purpose.
I'm familiar with the toolbar approach, but this needs to be done programmatically.

Is there any programmatic way to do this without producing duplicate field names?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Inserting pages from another document in a script

Post by Tracker Supp-Stefan »

Hello Claude Vidal,

Looking at the JS method - there's no provision to provide parameters for what to happen with e.g. form fields.
So I do not believe this can be controlled via that particular command directly.
What you will need to do is e.g. read the file from which you will import pages (this will require you to open it), grab all field names, check for duplicates, and if nay exist - change the field names in the source file before merging it's pages in the target.

Regards,
Stefan
claude vidal
User
Posts: 138
Joined: Wed Mar 09, 2016 12:47 am

Re: Inserting pages from another document in a script

Post by claude vidal »

Tracker Supp-Stefan wrote:Hello Claude Vidal,

Looking at the JS method - there's no provision to provide parameters for what to happen with e.g. form fields.
So I do not believe this can be controlled via that particular command directly.
What you will need to do is e.g. read the file from which you will import pages (this will require you to open it), grab all field names, check for duplicates, and if nay exist - change the field names in the source file before merging it's pages in the target.

Regards,
Stefan
That was my finding as well. Thanks.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply