Add more PDF tips

This commit is contained in:
lhark 2021-01-04 23:08:17 +01:00
parent de84216928
commit c9e22c74a5

17
how_to
View file

@ -220,6 +220,10 @@ PDF :
# range can be <start>-<end>, more info at pdftk --help # range can be <start>-<end>, more info at pdftk --help
Uncompress pdf file content : Uncompress pdf file content :
pdftk input.pdf output output.pdf uncompress pdftk input.pdf output output.pdf uncompress
Extract text from pdf (poppler):
pdftotext in.pdf out.txt
Extract images from pdf (poppler):
pdfimages <in.pdf> <imgs-prefix>
Add images and other files in a single pdf: Add images and other files in a single pdf:
convert [jpg|png|txt|pdf|...] output.pdf convert [jpg|png|txt|pdf|...] output.pdf
# Might need to tweak /etc/ImageMagick-7/policy.xml # Might need to tweak /etc/ImageMagick-7/policy.xml
@ -233,6 +237,19 @@ PDF :
xournal xournal
libreoffice Draw libreoffice Draw
inkscape inkscape
Batch mode with pdftk:
# http://www.myown1.com/linux/pdf_formfill.shtml
Finding the fields:
# pdftk needs java-commons-lang
pdftk form.pdf dump_data_fields_utf8 > fields.flds
Generating fdf file with values:
# https://github.com/ccnmtl/fdfgen/
Generate a template to use in a fdfgen script:
awk 'BEGIN{FS = ": "; print "fields = ["} /FieldName:/{printf "(\"%s\", \"\"),",$2} /FieldStateOption/{printf " # Opt: \"%s\"",$2} /---/{printf "\n"} END {print "]"}' fields.flds > fields.py
# http://home.myfairpoint.net/vzenxj75/downloads/fdf_gen_20080304.tgz (brittle as hell)
fdf_gen fields.flds values.txt fields.fdf
Filling the form:
pdftk form.pdf fill_form fields.fdf output filled_form.pdf
Fill dynamic XFA forms on linux: Fill dynamic XFA forms on linux:
Run Acrobat Reader DC 2019 on wine: Run Acrobat Reader DC 2019 on wine: