Page 1 of 1
PDF Bookmarks to individual file names
Posted: 2019-07-23T13:25:05-07:00
by Argyle
I’m splitting multi page PDF files into individual PNG images. Each png is a page from the file.
I’d love to be able to name my png’s according to the bookmark name of the pdf page they were converted from.
Is it possible?
Re: PDF Bookmarks to individual file names
Posted: 2019-07-23T15:11:01-07:00
by fmw42
Imagemagick cannot read PDF bookmarks. But you can number the pages.
Just use _%02d appended to the filename. This will work for up to 99 pages. If you want more, then use _%03d.
Here I start the scene numbering at 01 rather than 00.
First I create a simply PDF file:
Code: Select all
convert lena.jpg lena.jpg lena.jpg lena.pdf
Now I separate the pages
Code: Select all
convert lena.pdf -scene 1 lena_%02d.png
The result is 3 files:
Code: Select all
lena_01.png
lena_02.png
lena_03.png
Re: PDF Bookmarks to individual file names
Posted: 2019-07-24T05:28:01-07:00
by Argyle
Unfortunately appending the file names doesn’t help my situation. The PDF bookmarks contain order numbers. I’d like to name my PNG files according to those order numbers.
Acrobat will let me split the pdf into individual pages & use the bookmark as the file name. I can then convert the entire folder to PNG. It’s a longer less organized process but it gets the job done.
Re: PDF Bookmarks to individual file names
Posted: 2019-07-24T08:57:22-07:00
by 246246
You need some programming using some library that can handle PDF bookmark, for example Apache PDFBox in Java.
Following page would be your help:
https://memorynotfound.com/apache-pdfbo ... f-example/
You can also split it to single page pdf files in it, so then write a script that convert to png using ImageMagick.