1
Watch
3
Star
2
Fork
1
Issue

An Adobe Acrobat DC plug-in to generate PDF bookmarks (catalog).

liuzikai
liuzikai
pushedAt 1 year ago

liuzikai/Acrobat-PDF-Bookmark-Generator

An Adobe Acrobat DC plug-in to generate PDF bookmarks (catalog) based on given catalog information.

Author: liuzikai
Date: 02/18/2018

Revised based on Adobe Acrobat DC SDK project BasicPlugin.  

Develop and Test Environment:  

  • macOS 10.13.3
  • Adobe Acrobat Pro DC Version 2018.009.20050
  • Xcode Version 9.2

There are some JS scripts on the Internet that have similar function. However, these scripts can only make go-to-page actions with JS code, which is not supported by some PDF readers such as macOS Preview. But using plug-in, native jumping actions can be added to bookmarks.


中文说明

Install

For macOS, Adobe Acrobat DC  

Download BookmarkGenerator.acroplugin.

Copy BookmarkGenerator.acroplugin to /Users/(username)/Library/Application Support/Adobe/Acrobat/DC/Plug-ins.


Usage

1. Prepare a txt file containing catalog infomation.  

Format:

Index Title PageNumber

  Use . to show levels in index.

  Title can contain spaces.

  Index Title will be used as the name of bookmark.

For example:

The plug-in will use the first index level as "basic level", for example:  

Please make sure there is no excess new lines at the end of the txt file.  

If you have catalog pages in the PDF file, you can copy it out (maybe export to other form first) and process the text with some technology such as regular expressions.  


2. Open PDF file in Acrobat and switch to the first page of main body

Since the given page numbers may be different from the actual page number for PDF file, the plug-in need to confirm the first page of main body. For example,

Here is the the first page of main body. However, for PDF file, it is actually page 23.


3. Start the plug-in on menubar Plug-In Tool - Generate Bookmarks...

4. Confirm the first page of main body.

5. Select the catalog txt file.

6. Save the PDF file.


For Developers

This plug-in is developed on macOS and for Acrobat DC. It seems that it can't be directly applied to Win or other version of Acrobat. If you are interested in it, it would be great if you can help developing other versions. :)

Some tips:

  1. Adobe Acrobat DC SDK for Mac is developed based on old Xcode and macOS, so some revisions are needed.
  2. For Acrobat DC, it seems that plug-ins won't be valid if directly put in the application package.
  3. The file MacCopyToPlugins.sh is a script provided by SDK that runs after building. It can perform work such as copying the plug-in to the corresponding folder. In current project, please change the ACROBAT_PLUGINS_FOLDER in Environment.xcconfig to your own path.

Reference

Adobe Acrobat DC SDK for Mac

Acrobat DC SDK Documentation

Acrobat and PDF Library API Reference

在Acrobat中利用Javascript根据目录一键生成带页码的书签

ucloud ads