Create Bookmarks From Text File

New bookmarks can be added to the PDF document from a control ASCII text file. The control file format is a comma-delimited ASCII text that contains bookmark titles and their optional attributes such as text style, color, zoom, destination page, open/close state, named destination and optional keywords for specifying bookmark actions. The following bookmark actions are supported: "Go to a page in current document", "Go to a page in another document", "Open a web link", "Open a file", "Execute menu item". Multilevel bookmark hierarchy can be defined by properly indenting each bookmark definition record.

 

Preparing a Bookmark Control File

 

Use any text editor of your choice to create a bookmark control file. Create a new blank document and add bookmark definitions using the following format. Each bookmark definition should appear on a single line. Left indentation is used to determine parent-child relationships. It is recommended to use <Tab> symbol for indenting text lines. For example, the following text defines two top level bookmarks with two child bookmarks each:

 

Chapter 1

            Paragraph 1.1

            Paragraph 1.2

Chapter 2

            Paragraph 2.1

            Paragraph 2.2

 

Each bookmark definition record should occupy only a single line and is required to contain at least one element – a bookmark title. All other bookmark attributes are optional and can be added after a bookmark title using comma as field delimiter. Bookmark destination page (the page displayed in the viewer when user clicks on a bookmark) should always follow the title (if a page number is specified) and cannot appear in any other position in the record. All other attributes can appear in any order. It is important not to use comma for anything else besides a field delimiter. Blank lines are allowed in the file and will be ignored. The example below shows the same bookmark structure as in example above, but with destination pages (pages 10, 15, 20 and 25) associated with four of the child bookmarks.

 

Chapter 1

            Paragraph 1.1, 10

Paragraph 1.2, 15

Chapter 2

            Paragraph 2.1, 20

            Paragraph 2.2, 25

 

Destination page numbers should be always in the range between 1 and total number of pages in the target document. If destination page is outside of this range or is not specified, then no action will be assigned to the bookmark. Destination page definition should always appear right after a bookmark title. If a valid page number is specified, then a “Go to a page in this document” action is assigned to a bookmark. If a page number and a file definitions appear in a same record, then a "Go to a page in another document" action is assigned to the bookmark.

 

Use the following keywords to optionally define bookmark appearance attributes. Keywords are case-insensitive.

Keyword

Meaning

http:// Specifies a URL to open. If this keyword is specified, then a bookmark action is set to "Open a web link" action. For example, if bookmark record contains http://www.cnn.com entry, then this internet location will be displayed in the viewer when user clicks on the bookmark.
file:// Specifies a relative path to a file. This keyword can be used to specify two different types of bookmark actions: "Open a file" and "Go to a page in another document". If destination page number is specified, then a bookmark action is set "Go to a page in another document" otherwise it is set to "Open a file" action.
IMPORTANT: file path is relative to a current document location. For example, if you want to link to a file that is located in a subfolder "Notes" (one level below a current document), then use the following path: file://Notes/MyDocument.pdf
@destination Specifies a named destination to use. For example, @First Paragraph entry will refer to a named destination "First Paragraph". Named destinations can be used for both local and remote page references.
menu: Specifies a named action ("Execute a menu item"). For example, menu:FirstPage keyword sets bookmarks action to display a first page of a document. Standard named actions include: "NextPage", "PrevPage", "FirstPage", and "LastPage". These actions are supported on all PDF viewers. Many other named actions (that correspond to specific menu entries) can be used, however keep in mind that they may not be available in some PDF viewers. For example, "DeletePages" action (menu item) is not available in Adobe Acrobat Reader.

close

Bookmark will appear in the “closed” state (not showing its children). By default, all new bookmarks are shown in the “open” state. You can also use “open” keyword, but it is not necessary.

bold

Bookmark title appears in bold text style

italic

Bookmark title appears in italic text style

InheritZoom Sets zoom type to "Inherit Zoom" for this bookmark
FitWidth Sets zoom type to "Fit Width" for this bookmark
FitVisible Sets zoom type to "Fit Visible" for this bookmark
FitPage Sets zoom type to "Fit Page" for this bookmark
ActualSize Sets zoom type to "Actual Size" for this bookmark

red

Bookmark title appears in red color

green

Bookmark title appears in green color

blue

Bookmark title appears in the blue color

#xxxxxx

Bookmark title appears in the custom color. The 6 digit hexadecimal HTML color code will be used to define a bookmark title color. Hexadecimal color codes are widely used for defining colors in HTML and web pages. You can find a complete list of HTML color codes on numerous web pages on the internet (for example http://html-color-codes.com/ has a good selection of colors). Here are few examples of the hexadecimal color codes:
#FFFF00
#00FFFF
#FF00FF
#ABCDEF
#FEDCBA
#A1F4BB

Here is a sample of the control file that uses many of the keywords above. Keywords are shown in blue, destination pages in red and bookmark titles appears in green color.

 

Chapter One
        Paragraph A,
1, close, bold, ActualSize
                Page one,
1, italic, blue
                Page two,
2, italic, blue
                Page three,
3, italic, blue
        Paragraph B,
4, close, bold, InheritZoom
                Page 4,
4, italic, red
                Page 5,
5, italic, red
                Page 6,
6, italic, red
Chapter Two
        Paragraph C,
1, close, bold, FitWidth
                Page 7,
7, italic, #FF7F50
                Page 8,
8, italic, #FF7F50
                Page 9,
9, italic, #FF7F50
        Paragraph D,
4, close, bold, FitVisible
                Page 10,
10, italic, #FF00FF
                Page 11,
11, italic, #FF00FF
                Page 12,
12, italic, #FF00FF
Appendix A,
13, FitPage
Appendix B,
14, FitPage
Index,
15

 

Another set of examples illustrates advanced features such as linking to web pages, starting external applications, executing menu items, using named destinations, and opening documents:

 

View AutoBookmark Webpage, http://www.evermap.com/autobookmark.asp
Start External Application, file://myapplication.exe
Open Microsoft Word File, file://mydocument.doc
Open Another PDF Document, file://anotherpdf.pdf
Go to a page in another PDF,1, file://anotherpdf.pdf

Go to a named destination,@FirstChapter

Execute a menu item (Go to Next Page),menu:NextPage

 

Importing Bookmarks From a Text File

 

1. Open a PDF document to add bookmarks to by selecting "File > Open..." from the main menu.

2. Select "Plug-ins > Bookmarks > More > Create From Text File..." from the menu. "Create Bookmarks From Text File" dialog should appear on the screen.

3. Click "Browse..." button and select bookmark control file.

4. Input file will be load into preview area. You can review the content of the text file.

5. Select "Default zoom" and "Default color" options. These options will be used for bookmarks that do not have corresponding attributes specified.

6. Click "OK" button to generate bookmarks from the selected control file.