Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Pagebreak

Explorer ,
Mar 19, 2018 Mar 19, 2018

Is there a possibility to insert an empty page into a pdf form (by using js)?

TOPICS
PDF forms
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Mar 21, 2018 Mar 21, 2018

This code will add a new page to the end of the current file:

this.newPage()

Does your file have form fields? If so, then it's a bit trickier.

You can do it by converting your form to a Template object and then spawning new copies of it.
One of the parameters is to rename the fields in the spawned pages.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2018 Mar 19, 2018

Yes, using the newPage method of the Document object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 21, 2018 Mar 21, 2018

Could you please give me an example?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 21, 2018 Mar 21, 2018

Or is it even possible too take my whole formular and add it a second time at the bottom?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2018 Mar 21, 2018

This code will add a new page to the end of the current file:

this.newPage()

Does your file have form fields? If so, then it's a bit trickier.

You can do it by converting your form to a Template object and then spawning new copies of it.
One of the parameters is to rename the fields in the spawned pages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 21, 2018 Mar 21, 2018

I get this error:

NotAllowedError: Sicherheitseinstellungen verhindern den Zugriff auf diese Eigenschaft oder Methode.

Doc.insertPages:3:Field Button10:Mouse Up

Am I doing something wrong or might there be a security problem of my pc at work?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2018 Mar 21, 2018

This is not the code I provided... Please post the full code, and specify from where you're executing it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2018 Mar 21, 2018

I'm seeing this is from a MouseUp event of a button field. You can't use the insertPages command from that context. Not directly, at least.

It requires a privileged context, which means you need to run it though a trusted function in a folder-level script.

See: https://acrobatusers.com/tutorials/trust-and-privilege-in-acrobat-scripts

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2018 Mar 26, 2018

I don't really understand where to place this. What User Javascript folder?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2018 Mar 26, 2018

What's your version of Acrobat, and OS?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2018 Mar 26, 2018

Acrobat Pro DC 18.009.20044 / Win 10

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2018 Mar 26, 2018
LATEST

Then it should be something like:

C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts

This is the app folder, though, the user folder is more difficult to locate.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines