Skip to main content
New Participant
February 6, 2024
Question

How to highlight or put a border on every bookmarks ?

  • February 6, 2024
  • 1 reply
  • 1129 views

Hello, 

 

Does anyone know if there's a script I could use to higlight every bookmarks in my pdf please ?

 

I can't find it anywhere but it would be so useful to distinguish every title in my file, my aim is to have all the different title of a document (the different parts) to be visible. 

 

Juste imagine you have a title in the document "Part 1: the introduction of Adobe" and it would highlighted and the next one too "Part. 2: The options of Adobe". For example in yellow or whatever. 

 

I'm able to do it with a single word using a javascriptscode in Adobe. 

 

Thank you very much !

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
February 6, 2024

You can't do either of those things, but you can change the color of bookmark text, and make the text italics or bold. 

Here's the Acrobat JavaScript Reference entry for the bookmarks object properties.

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#bookmark-properties

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
New Participant
February 7, 2024

Thank you for your answer. However, it doesn't help me or I don't know how to it.

 

I really believe that if I automaticalley change de color of many words with this script, I should be able to do it as well with book marks. I just lack the knowledge to adjust this following script : 

 

var colHilite = color.blue; var oDoc = event.target; var aAnnts = oDoc.getAnnots({sortBy:"Author"}); for(var i=0;i<aAnnts.length;i++) { if(aAnnts[i].type == "Redact") { aAnnts[i].type = "Highlight"; aAnnts[i].strokeColor = colHilite; } }

 

Thanks if someone is able to help me !

 

ES

Thom Parker
Community Expert
February 7, 2024

Well, you believe wrong. That script does not change the color of words. It converts existing redaction annotations to a highlight annotations. It has literally nothing to do with bookmarks.  Annotations are objects that overlay the page.  Bookmarks are a list of named links to content in the PDF.  They do not appear on the page and so page objects do not affect them. 

Here's a video tutorial on the structure of PDF.

https://www.pdfscripting.com/public/FreeStuff/AcroForm_Concepts/Part1g_WhatsPDF_mp4.cfm

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often