Saturday 7 September 2019

PDF-List (Calc, pdftk)


PDF-List




"PDF-List" is a LibreOffice/OpenOffice Calc-Document with a Toolbar with 4 Buttons. You can import all PDFs of a chosen folder (optional with Subfolders) as Hyperlinks. Besides the usual ctrl-click on Hyperlink a custom set App can be used to open a selected PDF.

If the commandline-tool pdftk is installed you have more features:
- The list also shows the Page Count and the MetaData (Infokeys) of the PDFs.
- MetaData can be written back into the PDFs.
- PDFs can be merged.

So with pdftk you can use PDF-List as batch-Editor for PDF-Metadata (Infokeys) of multiple PDFs.

Get pdftk from here: https://www.pdflabs.com/

Download "PDF-List.ods" here: https://tinyurl.com/y45j4zc7


There are 4 Buttons in the Toobar:
1.ListPDFs
Please edit the first lines of Sub listPDFs to you liking (especially if you want to use pdftk or not.
sub listPDFs
Folderpath="E:\PDF"   'edit your default path here
subdirs=1   'to not list subfolders use subdirs=0
pdftkapp="pdftk"   'if you don't use pdftk then use: pdftkapp=""
You get a Folder-Selector. The list of imported PDFs will contain:

Without pdftk:
PDF-Name (Hyperlinked) - Size

With pdftk also the Page-Count and all available MetaData will be listed:
PDF-Name (Hyperlinked) - Size - Pages - Title - Author - Subject - Keywords - ...

If the Page-Count of a PDF is empty then the PDF was skipped on import because it probably was password-protected.


2.open_pdf_in_app
The PDF of the row you have selected will be opened in the given external App.
Please edit the first line of sub open_pdf_in_app to give the path to your external App.
sub open_pdf_in_app
PDF_App="E:\Installationsprogramme\Sumatra\SumatraPDF.exe"   'edit this path



Next 2 Buttons only work with installed pdftk:
3.Write_Info_to_new_PDF(s)
The Metadata of all PDFs of a selection range will be written back into the PDFs. The Original PDF will be moved into a subfolder called "!.OriginalPDFs", so you have a backup. (This subfolder "!.OriginalPDFs" will always be skipped when listing with Button 1)

You also can create new custom MetaData-Fields (in the Header-Row). Only filled cells will be written back into the PDF.
PDFs with missing Page-Count will be skipped because they likely are password-protected.


4.mergePDFs
All PDFs of a selection range will be merged into a new PDF. This will be called "mergedPDFs.pdf" and will be located in the Folder that is shown in cell A1.