Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
software:pdf [2009/03/27 09:27]
cyril created
software:pdf [2025/01/07 22:49] (current)
cyril [convert (image magick)]
Line 13: Line 13:
 </code> </code>
  
 +Compress PDF file containing images (''/screen'' compresses even more than ''/ebook''):
 +<code>
 +gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -sOutputFile=out.pdf in.pdf
 +</code>
 ===== PDFTK ===== ===== PDFTK =====
  
-Split and merge PDF files: +  * Split and merge PDF files:<code> 
-<code>+pdftk in.pdf cat 2-4 output out.pdf
 pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
 pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
 +pdftk A=one.pdf B=two.pdf cat A1 B1W output combined.pdf # rotate West B1 (E,N,W,S)
 +pdftk one.pdf two.pdf shuffle output combined.pdf # shuffle the two files (A1 B1 A2 B2 A3 B3...)
 </code> </code>
- +  * Encrypt/decrypt, set permissions, repair:
-Encrypt/decrypt, set permissions, repair:+
 [[http://www.accesspdf.com/article.php/20041129175231241]] [[http://www.accesspdf.com/article.php/20041129175231241]]
 +  * Rotate:<code>
 +pdftk in.pdf cat 1-left 2-down output out.pdf
 +</code>
 +
 +===== pdfjam =====
 +
 +  * split and merge:<code>
 +pdfjam file1.pdf '-' file2.pdf '1,2' file3.pdf '2-' --outfile output.pdf
 +</code>
 +  * set multiple pages in one:<code>
 +pdfjam --nup 2x1 --landscape true --frame false file.pdf
 +</code>
 +  * quickly rotate (pdf90, pdf180, pdf270):<code>
 +pdf90 file1.pdf
 +pdfjam --angle 180 in.pdf out.pdf
 +</code>
 +  * convert image to pdf in A4 format:<code>
 +pdfjam --paper a4paper --outfile file.pdf file.jpg
 +</code>
 +
 +===== sed =====
 +
 +  * crop pages (here remove 14% of page height at the bottom):<code>
 +sed 's/MediaBox \[0 0 612 1008*/MediaBox \[0 145 612 1008]/g'<in.pdf >out.pdf
 +</code>/!\ some tools such as pdftk or gs may consider the file as corrupted afterwards
 +
 +===== convert (image magick) =====
 +
 +Merge image files into a pdf file (but better use pdfjam for A4 conversion):
 +<code>
 +convert page-*.png -page A4 [-rotate 90] test.pdf
 +convert -density 300x300 test.png test.pdf
 +convert -units PixelsPerInch -density 300x300 -extent 2480x3508 -gravity center -background white test.png test.pdf
 +</code>
 +
 +Convert pdf page into image file at resolution 300dpi:
 +<code>
 +convert -density 300x300 test.pdf test.png
 +</code>
 +
 +Recompress the pages:<code>
 +convert -quality 80 page-1.jpg page-1c.jpg
 +</code>
 +
 +Erase a part of the image (especially useful for batch processing):<code>
 +convert page-1.jpg -fill white -draw "rectangle 0,0 300,1753" page-1c.jpg
 +</code>
 +===== pdftotext =====
 +
 +To grep into a pdf file:
 +<code>
 +pdftotext file.pdf - | grep "text"
 +</code>
 +
 +===== flpsed =====
 +
 +To add text on a pdf file.
 +You can save the file, but it doesn't work with landscape oriented pages...
 +
 +===== Xournal =====
 +
 +To add text, drawings, and highlight a pdf file. More complete and less buggy than flpsed.
 +
 +===== PDF-XChange Viewer =====
 +
 +Can deal with real PDF annotations (yellow boxes).
 +
 +Software for Windows, but that works in Wine ([[http://www.tracker-software.com/product/pdf-xchange-viewer|download]] the exe installer).
 +
software/pdf.1238146066.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0