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

Bookmark automation

Community Beginner ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Hi, I was wondering whether it was at all possible, from the Action feature or using some JavaScript, to automatically change the color of level-1 bookmarks in multiple PDFs (nor created from Word), and also to delete the first 2 bookmarks multiple PDFs.

Any idea will be welcome.

Thank you.

 

TOPICS
How to

Views

4.1K

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Is that change the formatting in your document itslef or in the bookmark panel on the side of the screen?

Within a document, the bokmarks do not really have a hierarchy, only on the side panel. As far as i remember, the side panel keep the text for the bookmark with basic formatting options. more at Page thumbnails and bookmarks in PDFs, Adobe Acrobat (scroll half-way down the page) to 'Change the text appearance of a bookmark'.

You can also check this Developing Acrobat Applications Using JavaScript (adobe.com) (page 126-127).

 

Also, to automate the deletion, do the 2 bookmarks have the same name in each document? what do they have in common?

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Thank you, Eric. What I am referring to is the bookmarks on the side panel, which have 2 levels in my case, reflecting the heading levels within the document. I want only the level 1s to have a different color.

And concerning the bookmarks to be delete in the side panel, they are just the first ones there. The names will differ in the different PDFs (translations) but they will always be positioned as first and second in the bookmark side panel. They should remain within the document be disappear in the bookmark side panel.

 

 

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

You can do is using this script (I used blue, since you didn't specify what color you wanted):

 

this.bookmarkRoot.children[0].remove();
this.bookmarkRoot.children[0].remove();
for (var i=0; i<this.bookmarkRoot.children.length; i++) {
	this.bookmarkRoot.children[i].color = color.blue;
}

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Thank you very much! How do I execute this, please?

 

 

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

From the JS Console, a button, an Action or a Custom Command, among others.

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Sorry, I ran it from here but it did not change anything in the selected PDFs:

Snag_7b66f1.png

 

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Did you add a Save command, too?

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Also, I think you used the code as the Action's description. It should be used under an Execute JavaScript command (make sure to untick the "Prompt User" check-box), followed by the Save command, like this:

 

try67_0-1667901656064.png

 

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Wonderful! It is working fine now.
How can I change the blue color to R=0, G=75, B=151 and specify that the font face should be bold, please?

 

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Use this

this.bookmarkRoot.children[i].color = ["RGB", 0/255, 75/255, 151/255];

this.bookmarkRoot.children[i].style = 2; // bold

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Excellent! It will save me a lot of time.

Many thanks, try67.

 

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 ,
Dec 02, 2022 Dec 02, 2022

Copy link to clipboard

Copied

Sorry to come back to you with this. I tried to enter the 2 lines of code but I receive a syntax error. Can you help, please? 

Snag_2214f6d.png

 

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 ,
Dec 02, 2022 Dec 02, 2022

Copy link to clipboard

Copied

This code was written for Acrobat, not for a web-page.

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 ,
Dec 02, 2022 Dec 02, 2022

Copy link to clipboard

Copied

Sorry, didn't realize this is from an Action file... Disregard the above comment.

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 ,
Dec 02, 2022 Dec 02, 2022

Copy link to clipboard

Copied

Does you change the sequence 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
Community Beginner ,
Dec 04, 2022 Dec 04, 2022

Copy link to clipboard

Copied

Sorry, what do you mean?

 

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Where does you enter the 2 lines of code?

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Well, exactly as shown in my screenshot.

 

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

What syntax error message are you getting? Why are you editing the SEQU file directly, instead of doing it via the Action Wizard in Acrobat?

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

OK, I am now trying in the Action Wiz

Snag_1101b7c.png

ard, and here's what I first get:

 

 

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

The file has been corrupted. You should not be seeing any of those XML tags in the JS editor.

Delete it and create a new one. Do NOT edit this file directly, only use the editing tools within Acrobat.

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

It IS WORKING now! Thank you.

Additional questions, if I may: 

- Would it be possible to have Acrobat save all processed files automatically without first asking?

- Would it be possible to have the same Acrobat action also add some text automatically to the Author and Subject fields of the processed PDFs before saving?

Snag_137badb.png

 

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Have you added the save step?

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

See:

Snag_15aeb57.png

 

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