Inserting pages from another document in a script

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

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

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

Inserting pages from another document in a script

Post by claude vidal » Wed Jan 24, 2018 9:31 pm

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: 2706
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel » Wed Jan 24, 2018 11:27 pm

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.
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 2706
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel » Wed Jan 24, 2018 11:36 pm

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

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

claude vidal
User
Posts: 132
Joined: Wed Mar 09, 2016 12:47 am

Re: Inserting pages from another document in a script

Post by claude vidal » Thu Jan 25, 2018 4:05 am

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: 13651
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 » Thu Jan 25, 2018 3:02 pm

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: 132
Joined: Wed Mar 09, 2016 12:47 am

Re: Inserting pages from another document in a script

Post by claude vidal » Thu Jan 25, 2018 7:40 pm

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: 2706
Joined: Wed Jan 03, 2018 6:52 pm

Re: Inserting pages from another document in a script

Post by TrackerSupp-Daniel » Thu Jan 25, 2018 8:14 pm

:)
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

Post Reply