I am searching for a command line tool to add bookmarks to a PDF file.
What I have is a page number
and a label
. Would love to create bookmark called label
linking to page page number
.
Does any one know a command line tool (preferably OSX) for doing this?
I have about 4000 pages PDF files and about 150 bookmarks and would love to automate it.
My plan is to use a system call within a r-script.
EDIT
I create about 4000 single PDF files with graphs and I am using the OSX system command /System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py
to join the PDFs together. Previously I was using pdfjoin
from pdfjam
package, but this was way too slow. In the end, this is how I get my PDF where I add the bookmarks by hand with Adobe Acrobat Professional at the moment.
Create Bookmarks in PDF File To set bookmarks in PDF document, you can click on the "View" button to open the left side toolbar, and then you can choose the "Bookmark" option. Right click on the space of the toolbar on the left side and click on the "Add Entry" button. Then you can create bookmark in PDF file.
Open the PDF document you would like to edit in Adobe Acrobat and the click on "Bookmarks" in the navigation bar. Click on "New Bookmark" at the top of the panel to add a new bookmark to the panel. Step 2. Go ahead and enter the name of the bookmark and then press "Enter".
How to Add a Bookmark in Soda PDF 1 Go to the Soda PDF official website to access the program. ... 2 Once the document is open in Soda PDF, click on the "Bookmarks" icon in the navigation panel. This will open the bookmark panel. 3 To add a bookmark to the PDF, click on "Add" on the bookmark panel. See More....
-Bookmarking a PDF document is very simple. -Can add security features to a PDF, including signatures and a watermark. -Can be used to create and convert PDF documents to other formats. -Can be used to create PDF forms and add data to existing PDF forms.
You can also use pdftk
. It is also available for OS X.
I'm not going through all the details here and now, because it's been done elsewhere at great length already. Just briefly:
Run one of these commands:
pdftk my.pdf dump_data output -
pdftk my.pdf dump_data output bookmarks+otherdata.txt
Study the format of the output.
Run PDFTK again:
pdftk my.pdf update_info bookmarks.txt output bookmarked.pdf
Additional Information
This is the Bookmark format I noticed after inspecting in Step 4 above.
BookmarkBegin
BookmarkTitle: -- Your Title 1 --
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: -- Your Title 2 --
BookmarkLevel: 1
BookmarkPageNumber: 2
BookmarkBegin
BookmarkTitle: -- Your Title 3 --
...
...
and so on...
And replace the above.. in the appropriate place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With