• 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: 2)
If you're a zombie and you know it, bite your friend!
We got both kinds of music: Country AND Western
Reply
#2
Nice. Unfortunately pdftk is hard to get (it seems banned due to licensing issues).

A simple yet effective Perl program with a similar purpose can be found in my MSPro tools on github: https://github.com/sciurius/MSPro-Tools/...pdf2csv.pl .

Several other tools exist on the interwebs.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 12.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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