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

Create a new page when pressing a button in PDF

New Here ,
Mar 09, 2017 Mar 09, 2017

Copy link to clipboard

Copied

Hi,

is it possible to create a new page in a PDF when a button is pressed? What would be the js-code for this?

Thanks

TOPICS
Edit and convert PDFs

Views

3.1K

Translate

Translate

Report

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 09, 2017 Mar 09, 2017

Copy link to clipboard

Copied

Yes, it's possible. The basic code would be simply:

this.newPage();

This will add a page to the end of the file, sized 612x792.

You can customize the location and size of the page by using parameters.

Read the documentation of this method for more details.

Of course, this will not work in Reader, only in Acrobat...

Votes

Translate

Translate

Report

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
New Here ,
Mar 09, 2017 Mar 09, 2017

Copy link to clipboard

Copied

Thanks a lot.

My goal is to insert a picture in a new page:

1) a button is pressed -> a new page is created

2) a field is created in the new page where the picture will be inserted

3) the user press the field and navigate to the picture repertory (event.target.buttonImportIcon();)

4) The user insert the picture in the field

So how can I insert a new field for picture in the new page in js?

Votes

Translate

Translate

Report

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 09, 2017 Mar 09, 2017

Copy link to clipboard

Copied

After creating the new page you can add a field to it using the addField method.

I would recommend that you look into using a Template instead, though. That will work in Reader and you won't need to create everything on the spot. You could create it in advance and just spawn the template when needed.

Votes

Translate

Translate

Report

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
New Here ,
Mar 10, 2017 Mar 10, 2017

Copy link to clipboard

Copied

I tested the function this.newPage(); without success. I'm using Adobe Standard DC.

- I added a new button in PDF

- In its properties, I set: on mouse up -> execute js -> I added this.newPage(); => I tested and no page is created.

About the using of templates, where can I get more information about it? I want my solution to work in Reader.

Votes

Translate

Translate

Report

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 10, 2017 Mar 10, 2017

Copy link to clipboard

Copied

Using this function requires a privileged context, ie it needs to run from a folder-level script that's installed on the user's local machine.

Regarding the templates: This issue was discussed here many times. Try searching around...

Votes

Translate

Translate

Report

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
New Here ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

Hi,

I searched how to use the templates and can now use the following js-code:

var t = this.getTemplate("Bildmangel");

t.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});

It looks like the defined template must be in the same PDF where the code is used. What if I want a template from another PDF document to be spawned in my current PDF?

Votes

Translate

Translate

Report

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 ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

Not possible.

Votes

Translate

Translate

Report

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
New Here ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

If I use the scan function of the android adobe reader to make some pictures, a new PDF will be created. How can I integrate that PDF with pictures in an existing PDF so that I have only one PDF?

The goal is that the user fills a PDF with data and join some pictures to that PDF.

Votes

Translate

Translate

Report

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 ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

LATEST

With Adobe PDF Pack you can combine PDF files on mobile devices.

Votes

Translate

Translate

Report

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