RackNerd Billboard Banner

How to Bookmark in Adobe Reader With a JavaScript Hack

If you use Adobe Reader (the free version of Acrobat), you’ve probably noticed it doesn’t let you add bookmarks to a PDF. That’s frustrating—especially if you’re dealing with a long document you want to navigate easily. But there’s a workaround: a simple JavaScript hack that lets you insert bookmarks manually.

Here’s how to do it.

What You’ll Need

  • Adobe Acrobat Reader DC (free version)
  • A PDF that allows JavaScript execution (most do)
  • Basic text editor (like Notepad or VS Code)

⚠️ This trick doesn’t add permanent bookmarks to the PDF itself—it creates a navigable structure while the file is open.


Step-by-Step: Add Bookmarks Using JavaScript

1. Open the PDF in Adobe Reader

Start by opening the PDF you want to bookmark.

2. Open the JavaScript Console

Press Ctrl + J (Windows) or Cmd + J (Mac). This opens the JavaScript console, where you can run custom scripts.

If nothing happens, your PDF might be locked down or the console disabled. Try another file or check your security settings.

3. Paste the JavaScript Code

Here’s a basic script to add bookmarks:

var root = this.bookmarkRoot;

var bm1 = root.createChild("Chapter 1", "this.pageNum = 0");
var bm2 = root.createChild("Chapter 2", "this.pageNum = 5");
var bm3 = root.createChild("Appendix", "this.pageNum = 10");

This creates three bookmarks:

  • Chapter 1 goes to page 1
  • Chapter 2 goes to page 6
  • Appendix goes to page 11

You can customize the labels and page numbers to fit your PDF.

🔢 Remember: Page numbers in JavaScript are zero-based, so page 0 = the first page.

4. Hit Enter

Once you paste the code, hit Enter to run it. The bookmarks should now show up in the left-hand bookmarks pane.


Customize It

Want nested bookmarks? Here’s how:

var root = this.bookmarkRoot;

var chapter = root.createChild("Chapter 1", "this.pageNum = 0");
chapter.createChild("Section 1.1", "this.pageNum = 1");
chapter.createChild("Section 1.2", "this.pageNum = 2");

This creates a parent-child structure under Chapter 1.


Tips and Troubleshooting

  • Can’t see the bookmarks pane? Press F4 to toggle it.
  • Script not working? Make sure JavaScript is enabled in Reader: Edit > Preferences > JavaScript.
  • Want bookmarks to stay? You’ll need the full version of Acrobat or use a free third-party tool like PDF-XChange Editor to save permanent bookmarks.

Why This Hack Works

Adobe Reader supports document-level JavaScript—often used for forms and automation. This hack hijacks that capability to create a dynamic table of contents. It’s not a perfect solution, but it’s quick, effective, and doesn’t cost a thing.


Final Thoughts

If you’re tired of scrolling through long PDFs in Adobe Reader, this JavaScript trick is a game-changer. It won’t give you permanent bookmarks, but it will help you work faster and smarter.

Try it, tweak it, and let us know how it works for you.


Want a downloadable version of this code or a step-by-step video tutorial? Drop a comment below, and I’ll hook you up.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
0
Would love your thoughts, please comment.x
()
x
Copy link