User Tools

Site Tools


pdftk

Programmino in linea di comando utilissimo per manipolare i PDF.

Si installa:

sudo apt-get install pdftk

per estrarre *solo* la pag. 551 da un PDF:

pdftk Talleyrand_5.pdf cat 552 output new.pdf

poi estraggo il frontespizio, in questo caso la pag. 2:

pdftk Talleyrand_5.pdf cat 2 output frontespizio.pdf

e poi li unisco:

pdftk frontespizio.pdf new.pdf cat output citazione.pdf

ovviamente ci dev'essere il modo per fare tutto in un sol passaggio…

per esempio:

pdftk Talleyrand_5.pdf cat 2 552 output citazione.pdf

e difatti funziona!


Per estrarre più pagine:

pdftk Eliot.pdf cat 247-248 317-359 output MBB.pdf

Per inserire della pagine all'interno di un documento:

pdftk A=Rendicontazione_Gramsci.pdf B=Fattura_Chomel.pdf cat A1-7 B A8-end output output.pdf

aggiunge il pdf “Fattura_Chomel” dopo la pagina 7 di “Rendicontazione_Gramsci” e riprende da pagina 8.


Per alleggerire un PDF:

ps2pdf -dPDFSETTINGS=/ebook BiggerPdf SmallerPDF 

oppure, con GhostScript:

sudo apt install ghostscript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf

dove i settings possono essere prepress, ebook o, meglio ancora, screen

https://itsfoss.com/compress-pdf-linux/


Ho provato a confrontare un'installazione del programma su una Debian Buster e su una FreeBSD 11.4, headless, nel caso dovessi utilizzarlo in una macchina virtuale. Queste sono le differenze.

Debian:

francesco@biblioteca:~$ pdftk -help
pdftk port to java 3.0.2 a Handy Tool for Manipulating PDF Documents
Copyright (c) 2017-2018 Marc Vinyals - https://gitlab.com/pdftk-java/pdftk
Copyright (c) 2003-2013 Steward and Lee, LLC.
pdftk includes a modified version of the iText library.
Copyright (c) 1999-2009 Bruno Lowagie, Paulo Soares, et al.
This is free software; see the source code for copying conditions. There is
NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

FreeBSD:

$ pdftk -help
pdftk port to java 3.2.2 a Handy Tool for Manipulating PDF Documents
Copyright (c) 2017-2018 Marc Vinyals - https://gitlab.com/pdftk-java/pdftk
Copyright (c) 2003-2013 Steward and Lee, LLC.
pdftk includes a modified version of the iText library.
Copyright (c) 1999-2009 Bruno Lowagie, Paulo Soares, et al.
This is free software; see the source code for copying conditions. There is
NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pdftk.txt · Last modified: 2021/01/14 11:18 by francesco