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

Is it possible to convert the actions to javascript code?

New Here ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

Scenario: I have button and I assigned some actions to it using the add button from action tab, e.g., first action "Go To A Page View" and second action "Execute A Menu Item".

Is there an easy way to convert/export these actions as Javascript to use it somewhere else or tweak it?

I know I can write the javascript from scratch, but would be nice to use this as a way for fast javascript built.

Thank you

TOPICS
Acrobat SDK and JavaScript

Views

91

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 ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

No, there's no easy way. The things you can do in some actions can also be done in JavaScript, but you'd have to study it and write the code. Many other actions do things impossible in JavaScript.

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 ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

Actually, it's not that difficult to do... But it depends on what you want to achieve, exactly.

Do you just want to jump to a page, or do you want to show an exact point on it? And what menu item do you want to execute?

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 ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

Mostly it was general question.

But for now. I have pdf portfolio with several pdf files.

For the "Go To A Page View" I want to jump from opened pdf back to portfolio. When set it shows Go to a page in another document, File: Parent document, Page: 1, Zoom level: Fit Width. So far I have not figured out the javascript for this.

For the "Execute A Menu Item" it is View>Portfolio>Cover Sheet. This is easy to change to javascript app.execMenuItem("CollectionShowRoot");

Thank you.

 

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 ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

I'm not sure this kind of action is going to be possible. You can always try closing the file, though. That might take you back to the parent Portfolio file.

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 ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

The problem with file closing is that the Cover page is not automatically displayed. So extra clicks are necessary from the menu. Also it is not very user friendly for people not familiar with portfolios.

I tried to add document level script as above for Document Will Close, but it does not work which make sence because in document view the portfolio menu is not available and the script is executed before close and not after close.

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 ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

LATEST

For what I need this script works. It extracts the name of the parent file.

var nm = path.split("/").pop();

nm = nm.substring(0, nm.indexOf("|"));

app.openDoc(nm);

app.execMenuItem("CollectionShowRoot");

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