Apache PDFBox Application Extension - A Simple Utility base on Apache PDFBox to help you to read PDF Document Attributes and set PDF Document Attributes.
-
PDF Document Attributes list:
-
title
-
subject
-
keywords
-
author
-
creator
-
producer
-
creationDate
-
modificationDate
-
pages(page num of pdf, READ ONLY)
-
Click link Assets → Source code(zip) or Source code(tar.gz)
Download pdfbox-app-ext-x.x.x.tar.gz (pdfbox-app-ext-x.x.x.zip)
Unzip pdfbox-app-ext-x.x.x.tar.gz
-
Download pdfbox-app-ext bin file.
Click link Assets → pdfbox-app-ext-bin-x.x.x.tar.gz ( or pdfbox-app-ext-bin-x.x.x.zip)
Download pdfbox-app-ext-bin-x.x.x.tar.gz ( or pdfbox-app-ext-bin-x.x.x.zip)
-
Unzip pdfbox-app-ext bin file.
Unzip pdfbox-app-ext-bin-x.x.x.tar.gz
-
Add the app directory to the PATH environment.
nano ~/.bashrc
export PATH=~/TOOLS/pdfbox-app-ext-bin-x.x.x:$PATH
[Ctrl + o (Save)]
[Ctrl + x (Exit nano)]
exit
pdfbox-app-ext just provide two functions Read PDF Attributes, Set PDF Attributes.
$ pdfbox2 DumpPDFInfo -V
Missing required parameter: '<INPUTFILE>'
Show PDF Document properties.
Usage: pdfbox2 DumpPDFInfo [-h] [(-F=<saveToPropsFile> | -f)] (-e | ([-n] [-t]
[-a] [-s] [-k] [-c] [-p] [-r] [-m]))
[@<filename>...] <INPUTFILE>...
Prints usage help and version help when requested.
[@<filename>...] One or more argument files containing options.
<INPUTFILE>... The PDF document to use
-h, --help Print usage help and exit.
Save Output To props File:
-f, --saveDFile Save Output To Default props File - $inputfile.props.
txt
-F, --saveToPropsFile=<saveToPropsFile>
Save Output To props File
PDF Info Options:
PDF Info Options one bye one:
-a, --author Author
-c, --creator Creator
-k, --keywords Keywords
-m, --modificationDate Modification Date
-n, --numofpages Number Of PDF Pages
-p, --producer Producer
-r, --creationDate Creation Date
-s, --subject Subject
-t, --title Title
PDF Info Options:
-e, --everything PDF Info Options for all - auto include -n, -t, -a,
-s, -k, -c, -p, -r, -m
Usage Exmaple1:
pdfbox2 DumpPDFInfo -e README.pdf
Usage Exmaple2:
pdfbox2 DumpPDFInfo -a -t -s README.pdf
Usage Exmaple3:
pdfbox2 DumpPDFInfo -e -f README.pdf
Usage Exmaple4:
pdfbox2 DumpPDFInfo -e -F README.pdf.props README.pdf
-e
) to console.$ pdfbox2 DumpPDFInfo -e README.pdf
pages=12
title=Asciidoctor
subject=null
keywords=null
author=Dan Allen, Sarah White
creator=Asciidoctor PDF 1.6.0, based on Prawn 2.4.0
producer=Dan Allen, Sarah White
creationDate=2022-03-16T19:09:00.000+08:00
modificationDate=2022-03-16T19:02:56.000+08:00
-a
, -t
, -s
,) to console.$ pdfbox2 DumpPDFInfo -a -t -s README.pdf
title=Asciidoctor
subject=null
author=Dan Allen, Sarah White
-e
) output to file README.pdf.props.txt
(by argument -f
)$ pdfbox2 DumpPDFInfo -e -f README.pdf
-e
) output to file README.pdf.props
(by argument -F
)pdfbox2 DumpPDFInfo -e -F README.pdf.props README.pdf
-t
, -n
) to console$ pdfbox2 DumpPDFInfo -t -n README.pdf
$ pdfbox2 ApplyPDFInfo -V
Missing required options and parameters: '--outputfile=<outputfile>', '<INPUTFILE>'
Set PDF Document properties.
Usage: pdfbox2 ApplyPDFInfo [-hU] [-a=<author>] [-c=<creator>] [-k=<keywords>]
[-m=<modificationDate>] -o=<outputfile>
[-p=<producer>] [-r=<creationDate>] [-s=<subject>]
[-t=<title>] [@<filename>...] <INPUTFILE>...
Prints usage help and version help when requested.
[@<filename>...] One or more argument files containing options.
<INPUTFILE>... The PDF document to use
-a, --author=<author> Author
-c, --creator=<creator> Creator
-h, --help Print usage help and exit.
-k, --keywords=<keywords> Keywords
-m, --modificationDate=<modificationDate>
Modification Date
ISO Datetime formate -
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
EX:"2022-03-16T19:02:56.000+08:00"
-o, --outputfile=<outputfile>
Write Out PDF document
-p, --producer=<producer> Producer
-r, --creationDate=<creationDate>
Creation Date
ISO Datetime formate -
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
EX:"2022-03-16T19:02:56.000+08:00"
-s, --subject=<subject> Subject
-t, --title=<title> Title
-U, --allowSetNULL Allow Set NULL value to attributes - NULL
if set this , and value is NULL will set attribute
to be NULL!
if not set this , and value is NULL will skip to
set attribute!
Usage Exmaple1:
pdfbox2 ApplyPDFInfo -t "My Title" -s "My Subject" -a "Demo Author1" -o README.
NEW.pdf README.pdf
Useage Exmaple2:
pdfbox2 ApplyPDFInfo @README.props
#####README.props
#####
--title "Test Title 1"
--keywords "My Keyword 1, My Keyword 2, My Keyword 3"
--author "Author1"
--subject "Subject 1"
--producer "Producer 1"
--creator "pdfbox-app-ext"
--creationDate 2022-05-16T19:08:36.000+08:00
--modificationDate 2022-05-16T19:02:56.000+08:00
--outputfile DEMO.pdf
README.pdf
#####
Useage Exmaple3:
pdfbox2 ApplyPDFInfo @README.pdf.props.txt -o README.NEW.pdf README.pdf
#####README.pdf.props.txt
#####
--title "My Title A"
--subject "My Subject B"
--keywords "My keywords C1, My keywords C2, My keywords C3"
--author "Author D"
--creator "PDFBoxExt"
--producer "DemoApp1"
--creationDate "2022-04-16T19:09:00.000+08:00"
--modificationDate "2022-04-16T19:02:56.000+08:00"
#####
Useage Exmaple4:
pdfbox2 ApplyPDFInfo @README.pdf.props.txt -U -o README.NEW.pdf README.pdf
#####README.pdf.props.txt
#####
--title "My Title A"
--subject "NULL"
--keywords "My keywords C1, My keywords C2, My keywords C3"
--author "NULL"
--creator "PDFBoxExt"
--producer "DemoApp1"
--creationDate "2022-04-16T19:09:00.000+08:00"
--modificationDate "2022-04-16T19:02:56.000+08:00"
#####
pdfbox2 ApplyPDFInfo -t "My Title" -s "My Subject" -a "Demo Author1" -o README.
NEW.pdf README.pdf
README.props
pdfbox2 ApplyPDFInfo @README.props
--title "Test Title 1"
--keywords "My Keyword 1, My Keyword 2, My Keyword 3"
--author "Author1"
--subject "Subject 1"
--producer "Producer 1"
--creator "pdfbox-app-ext"
--creationDate 2022-05-16T19:08:36.000+08:00
--modificationDate 2022-05-16T19:02:56.000+08:00
--outputfile DEMO.pdf
README.pdf
pdfbox2 ApplyPDFInfo @README.pdf.props.txt -o README.NEW.pdf README.pdf
--title "My Title A"
--subject "My Subject B"
--keywords "My keywords C1, My keywords C2, My keywords C3"
--author "Author D"
--creator "PDFBoxExt"
--producer "DemoApp1"
--creationDate "2022-04-16T19:09:00.000+08:00"
--modificationDate "2022-04-16T19:02:56.000+08:00"
pdfbox2 ApplyPDFInfo @README.pdf.props.txt -U -o README.NEW.pdf README.pdf
--title "My Title A"
--subject "NULL"
--keywords "My keywords C1, My keywords C2, My keywords C3"
--author "NULL"
--creator "PDFBoxExt"
--producer "DemoApp1"
--creationDate "2022-04-16T19:09:00.000+08:00"
--modificationDate "2022-04-16T19:02:56.000+08:00"
-t
, -s
) to output file README.NEW.pdf (by argument -o
) .$ pdfbox2 ApplyPDFInfo -t "My Title" -s "My Subject" -o README.NEW.pdf README.pdf
-
Chanage Code Page to 65001 (UTF-8)
> chcp 65001
-
call pdfbox2 by full path
> C:\TOOLS\pdfbox-app-ext-bin-0.0.1-SNAPSHOT\pdfbox2 DumpPDFInfo -e ZZZAAA.pdf pages=12 title=Asciidoctor subject=My Subject keywords=My Keywords author=Dan Allen, Sarah White creator=Asciidoctor PDF 1.6.0, based on Prawn 2.4.0 producer=Dan Allen, Sarah White creationDate=2022-03-16T04:02:56.000-07:00 modificationDate=2022-03-16T04:02:56.000-07:00 > C:\TOOLS\pdfbox-app-ext-bin-0.0.1-SNAPSHOT\pdfbox2 DumpPDFInfo -e -f ZZZAAA.pdf