Page 1 of 1

Inserting pages from another document in a script

Posted: Wed Jan 24, 2018 9:31 pm
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

Re: Inserting pages from another document in a script

Posted: Wed Jan 24, 2018 11:27 pm
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.

Re: Inserting pages from another document in a script

Posted: Wed Jan 24, 2018 11:36 pm
by TrackerSupp-Daniel
I forgot to note, you do need to select the dropdown option, Copy with Rename for this method to work

Re: Inserting pages from another document in a script

Posted: Thu Jan 25, 2018 4:05 am
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?

Re: Inserting pages from another document in a script

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

Re: Inserting pages from another document in a script

Posted: Thu Jan 25, 2018 7:40 pm
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.

Re: Inserting pages from another document in a script

Posted: Thu Jan 25, 2018 8:14 pm
by TrackerSupp-Daniel
:)