• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script to convert pdf bookmarks to csv files
#1
Being a big believer in making the computer do the heavy lifting, I just wrote this simple script to extract the bookmarks from a pdf file and reformat them into a csv file for import into mobilesheets.

The script requires pdftk, paste and sed.  The latter two (paste and sed) will likely be installed by default on any Linux computer since they are standard Unix utilities.  pdftk is also available for most Linux distributions but it may not be present by default so you might have to install it if it's not already there.

(If you're not sure, the command "which pdftk" will tell you if it's already installed.)

To use the script simply mark it as executable and specify the name of the pdf file on the commandline.

Example:  pdfbookmarktocsv.scr myfile.pdf

That will process a pdf file named myfile.pdf and you will get a file named myfile.csv out of it.

Of course, the pdf file that you're processing must have bookmarks in it.  If there are no bookmarks, then the output file will have no content.

EDIT:  I should point out that the advantage of doing this rather than a straight pdf import (which is supported by mobilesheets) is that the csv file is more flexible and gives you a chance to add any fields or edits that you want before proceeding with the import.


Attached Files
.zip   pdfbookmarktocsv.zip (Size: 468 bytes / Downloads: 23)
If you're a zombie and you know it, bite your friend!
We got both kinds of music: Country AND Western
Reply


Messages In This Thread
Script to convert pdf bookmarks to csv files - by Frank Cox - 04-23-2022, 02:51 PM



Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2024 MyBB Group.