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

Contributor ,
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, PDF forms

Views

221

Likes

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
Most Valuable Participant ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

Saving will save the whole file, by definition. Adobe really want to sell Acrobat to everyone for this kind of job.

Likes

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

Copy link to clipboard

Copied

I just checked  app.execMenuItem("SaveAs") is also not working in adobe Reader

Likes

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
Most Valuable Participant ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

That should work, but the deletePages command will not (unless that page was spawned from a Template)...

Likes

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

Copy link to clipboard

Copied

Yes, the pages are spawned from a template.. delete pages comman is working but the app.execMenuItem("SaveAs") not working.... If  you can tell me a method via which both  1st page is deleted and then the file can be saved when used in Adobe reader

Likes

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

Copy link to clipboard

Copied

Does it work in Adobe Acrobat?

Likes

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

Copy link to clipboard

Copied

"SaveAs" is working for me in Reader XI.

Likes

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

Copy link to clipboard

Copied

SaveAs works when you make the file READER EXTENDED.... but since i am also using template scripts so i cannot save it as reader extended .. in that case saveas doesnot work it only works when you save it as reader extended

Likes

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

Copy link to clipboard

Copied

No, even without it it works, if you use a relatively new version of Reader (XI or higher, I believe).

Likes

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

Copy link to clipboard

Copied

I have adobe reader dc 2020.009.....  and it doesnot work if i use it without reader extended .... it works fine when i save the file as reader extended

Likes

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

Copy link to clipboard

Copied

 :... if you can make the saveAs work without reader extended

what i want is when the user select the dropdown only the corresponding pages (template method),  after that on clicking the button only the country pages(it can be multiple pages, here it is of only 1 page)  should be saved not the cover page..

 

 

Likes

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

Copy link to clipboard

Copied

Like I wrote, it worked fine for me. I don't see where you have this code in your file. If you send it with the code I could test it (again). You used extractPages, which won't work in Reader.

 

And you can't spawn from an array, but you can use a for-loop (with or without an array) to issue multiple spwan commands, sure.

Likes

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

Copy link to clipboard

Copied

ok can i SaveAs a file with specific pages only .. like if i have 11 pages file and using app.exeMenuItem("SaveAs") save only specific pages.......

Likes

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

Copy link to clipboard

Copied

No.

Likes

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

Copy link to clipboard

Copied

then what methods should i use so that i have template spawing plus  saving the pdf file with specific pages in reader

Likes

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

Copy link to clipboard

Copied

But the first page in your file is not spawned from a Template (the other pages are). Therefore, it can't be deleted in Reader.

Likes

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

Copy link to clipboard

Copied

ok how about the print method.......... once the templates are spawned via dropdown.. and from button run the print() method .... to print (to pdf using pdf printer) all the pages except first page  how to do it. I know to print specific pages ex : this.print(false, 1) this prints the second page.. but how to print all pages except for first page since the  no. of spawn will vary;

Likes

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

Copy link to clipboard

Copied

Reader doesn't come with the PDF printer, either, but it's possible they could have another printer that will do it (although you can't count on it). Anyway, you can do it like this:

this.print({nStart: 1, nEnd: this.numPages-1});

Likes

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

Copy link to clipboard

Copied

I don't want to show the print dialog box... in this script this.print({nStart: 1, nEnd: this.numPages-1});   i changed it to this.print(false, {nStart: 1, nEnd: this.numPages-1});

but doesnot work

Likes

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

Copy link to clipboard

Copied

ok got the print script to work without print dialog box this.print(false, 1, this.numPages-1);

Likes

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

Copy link to clipboard

Copied

Also how to delete the spawned pages before if the next dropdown option is selected.. plz refer to my file ...... like user chooses INDIA then it spawn the INDIA page but when the user changes the option to USA, then it should delete the INDIA page then spawn USA. this i was able to do when there was only 1 template for each country (see the pdf file i attached in the previous mssg)....  but when there the number of pages vary for each country then how to do it

Likes

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

Copy link to clipboard

Copied

this.deletePages(1, this.numPages-1);

Likes

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

Copy link to clipboard

Copied

we already have pdf printer installed on computers .. so print method is no issue..

Likes

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

Copy link to clipboard

Copied

For now everything expected is working great  Thanks for your guidance.......

will post if i get stuck with something.

 

thanks

Likes

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

Copy link to clipboard

Copied

LATEST

 

 

...

Likes

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