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

Use app.execMenuItem("SaveAs"); script to save all pages of the pdf except for the 1st page.

Engaged ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

I want to save a pdf file via button using the app.execMenuItem("SaveAs");  but I want to exclude the first page of the file and save the remaining pages.    this .extractPages() doesnot work with Reader.. thatswhy want to use the Menuitem but want to exclude the 1st page.  In other words i want a method which will save the file (except for 1st page) in adobe reader.

 

Below is the script i am using in the button field  for deleting the first page and using menuItem to save it but it is not working in reader.

this.deletePages(0);
app.execMenuItem("SaveAs");

 

Plz guide.

 

Thanks

TOPICS
Acrobat SDK and JavaScript

Views

3.2K

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 ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Acrobat Reader can't extract pages!

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 ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

Hi!

 

I'm creating a form that has a button that extracts the page number 0 and 2 but as in Acrobat Reader extraction is not allowed, it's not working (As you said).

 

Is there an alternative? like writting an script with a "save as" function that saves a certain number of pages.

 

Thanks in advance

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 ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

The only way something like that can be done in Reader is if the other pages were spawned from Template objects. Then you could delete them, and save the remaining pages as a new file.

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 ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Thank you for the info. I'll try to explain my idea better :).

 

I've created a 4 pages form with acrobat pro DC. and this form has two different users.

 

The "first-level" user will fill some fields and after that (with many readonly fields enabled and some other hidden), that user will send the edited form to a "second-level" user. This second and last user only has to fill the page number 2.

 

Once he clicks on a "submit" button, we would like to generate a readonly pdf file with all the pages except the page number 2 (the page number 1 if counting zero-based)

 

As the extraction is not an option, I have tried to make a script using app.execMenuItem("SaveAs") and also tried printing as pdf but I have issues in both cases:

 

- Is there a way to use the "save as" method which saves all pages except page 2?

If so is possible to only flatten this copy? (I want the original form as it was).

Is there a way to edit that new copy before generate it? I would like to hide some fields on that new copy.

 

- The second option I tried only works if the virtual pdf printer is called "Adobe PDF". I

attach a capture of the script but as I said, only works if the virtual PDF printer is called Adobe PDF... it would be awesome if there is an option that detects the installed o default PDF virtual printer of the computer where is the form running.

 

Thank you again

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
LEGEND ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

"Is there a way to use the "save as" method which saves all pages except page 2?"

No. (1) Reader. As we have said, Reader cannot extract pages. Changing "extracts" to "saves all pages except" doesn't change things - you still want to extract, and it still can't. (2) Acrobat. No. Save just saves. To extract pages in Acrobat you have to either delete the pages you don't want (and make sure not to overwrite the original) or create a new document, then copy only the required pages.

 

"detects the installed o default PDF virtual printer "

The concept of a "default PDF printer" does not exist. But since your users will need Acrobat, Adobe PDF will be available.

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 ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

hello again Ok, no extraction on reader no "save as".

 

You say: To extract pages in Acrobat you have to either delete the pages you don't want (and make sure not to overwrite the original)

 

How can I make a copy without overwritting the original? I couldn't find any info on the Acrobat SDK documentation.

 

Kind regards

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
LEGEND ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

There is not supposed to be an alternative. Adobe designed it so people wanting to extract pages would buy Acrobat. If there is some clever trick, they may close the loophole.

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
Engaged ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Also one more question can we make array of templates and make that array to spawn instead of each template page...

like for country1  i will have 8 pages .. so can we name the template of 8 pages be  Country1.0, Country1.1 ... Country1.7 , then make them in a array variable then set that array to spawn

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 ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

LATEST

You can put the names of the templates in an array and then iterate it, get the Template object based on each item and then spawn from it, but you can't spawn directly from the array itself, no.

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
LEGEND ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

That is not too surprising. You may be going beyond the expected model for Reader (fill a form, submit form data to a web site). Even submitting an entire form may not work.

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