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

Saving single page from multi page PDF to original file

Community Beginner ,
Dec 31, 2016 Dec 31, 2016

Copy link to clipboard

Copied

Hi All

I'm trying to open a single page from a multi page pdf using illustrator, edit the page and then save it back to the original multi page pdf, however I'm struggling to get the desired behaviour using a script.

On opening the pdf manually the page selection dialog states "To save this page back to the original multiple-page pdf, use the "Save" command, and this works when I click it, however when I use a script to save the opened pdf it only saves an ai file and doesn't updates the original pdf.

Here's the line in the script I tried to use to get the same behaviour as clicking 'save':

app.activeDocument.save()

Can anyone suggest how I might be able to achieve this in a script? I could consider art boards but it seems there should be a simple way to get the same behaviour as clicking save.

Thanks for any pointers.

TOPICS
Scripting

Views

1.8K

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

correct answers 1 Correct answer

Enthusiast , Jan 01, 2017 Jan 01, 2017

If CS6+, you can use:

app.executeMenuCommand('save');

Votes

Translate

Translate
Adobe
Enthusiast ,
Jan 01, 2017 Jan 01, 2017

Copy link to clipboard

Copied

If CS6+, you can use:

app.executeMenuCommand('save');

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 Beginner ,
Feb 05, 2017 Feb 05, 2017

Copy link to clipboard

Copied

Hi moluapple

Thanks for your response, this seems like the right approach however adding app.executeMenuCommand('save') also seems to stop the preceding lines of the script from being run. I've posted a new question looking at this specifically:

js executeMenuCommand('save') blocks rest of script

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 Beginner ,
Feb 05, 2017 Feb 05, 2017

Copy link to clipboard

Copied

LATEST

Think I have the solution:

// Remove a layer from the pdf

app.activeDocument.layers.getByName('Layer 1').remove(); 

// redraw (otherwise preceding script lines are ignored)

redraw();

// Save the pdf using the menu command

app.executeMenuCommand ('save'); 

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