User Tools

Site Tools


pdftk

This is an old revision of the document!


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:

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.
francesco@biblioteca:~$ ssh ks 
Last login: Thu Jan 14 11:00:54 2021 from 62.160.160.194
FreeBSD 11.4-RELEASE-p5 (GENERIC) #0: Tue Dec  1 11:46:55 UTC 2020

server    : 367031
ip        : 37.187.3.48
hostname  : ks3367031.kimsufi.com

Want colour in your directory listings?  Use "ls -G".  "ls -F" is also useful,
and they can be combined as "ls -FG".
$ 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.1610619477.txt.gz · Last modified: 2021/01/14 11:17 by francesco