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

Button Javascript Save Page to separate PDF

New Here ,
Feb 28, 2021 Feb 28, 2021

Copy link to clipboard

Copied

Hi,

 

I'm trying to do something very specific that seems to have been asked many times, but much information appears to be out of date in today's world of security precautions.

 

I am trying to create a button on the last page of a PDF document that will allow a user, using Adobe Reader, to save the last page of the document to a separate PDF file preferably under the same folder as the current PDF that it was "extracted" from.

 

In running the this.extractPages() function, I do not believe that a user has the ability to actually execute this function without going through some major configuration hoops to their Adobe Reader.

 

It would be ideal to have the single page PDF open in a new tab and bring up the dialogue box for the Adobe Reader user to save to a location where they want it to be, and that may sound like it’s a bit more "security-minded" in that the script therefore is not saving the document itself.

 

Using:

this.extractPages({nStart:5, nEnd:5, CPath:'profile.pdf'});

this.extractPages(5, 5, 'profile.pdf'}); 

 

Seems to be a method that is no longer allowed by a normal user and it seems to be more complex of how to achieve the desired outcome that I want for the users.

 

Any thoughts?

TOPICS
Acrobat SDK and JavaScript , Mac , Windows

Views

118

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
Community Expert ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Reader can't extract pages, at all.

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
New Here ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Yes I know, but I am trying to develop this capability in Adobe Acrobat Pro.

Are you saying that there is nothing that can be developed in Pro for a
normal user to use as a button?

It seems like I don't want to use the *extractPages()* function at all, and
was hoping that there were some better methods/functions to do this
programmatically.

--
Daniel

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
Community Expert ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Well, in your original question you mentioned wanting to do it in Reader,
which is out of the question.
In Acrobat you can use extractPages, but with certain limitations.
If you don't specify the file-path then you can use it directly from a
button and the extracted file will be opened as a temporary, un-saved, file.
If you want to specify the file-path then you have to run the code from a
trusted context, such as a folder-level script that needs to be installed
on the local computer of each user.

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
Community Expert ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

[bug in forum duplicated my reply]

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
LEGEND ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

LATEST

Reader can't extract pages. Really, it can't. This is by design, like most of the limitations of Reader, because what Adobe really want to do is sell licenses to Acrobat.

 

So, Reader cannot do this at all. As a programmer you still can't do it. A button can't be added to make Reader do what it is designed not to do. (The documentation of extractPages tells you this, via the "quick bar"; always check it!)

 

Second issue. You have NEVER been able to embed JavaScript in a PDF that saves a file. This is not a new security limitation, but a vital one which has always been there - at least 20 years anyway. Imagine if a file you downloaded from the internet could start reading and writing files on your system!! 

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