Difference between revisions of "PDF"

From braindump
Jump to navigation Jump to search
Line 8: Line 8:
== Convert images to PDF documents ==
== Convert images to PDF documents ==
Assuming you have a few images laying around that need to be converted to a PDF with a paper size in DIN A4.
Assuming you have a few images laying around that need to be converted to a PDF with a paper size in DIN A4.
convert -repage A4 -compress jpeg -quality 80 INPUT01.tif INPUT02.tif INPUT03.tif OUTPUT.pdf
convert -repage ''<format>'' -compress ''<algorithm>'' [-quality ''<quality in %>''] INPUT.tif OUTPUT.pdf

The below example is with lossy JPEG compression at a compression ration of 80%. A higher number under quality yields a clearer image but requires more disk space.
'''Note:''' the -quality option is optional but if you want to retain full control over the outcome I would suggest you use it.
convert -repage a4 -compress jpeg -quality 80 INPUT01.tif INPUT02.tif INPUT03.tif OUTPUT.pdf

For lossless PDFs using the the TIFF format for stoage there are two options either LZW compression or ZIP. ZIP seems to be a bit more efficient. Note the -quality field is not required.
convert -repage a4 -compress lzw INPUT01.tif INPUT02.tif INPUT03.tif OUTPUT.pdf
or
convert -repage a4 -compress zip INPUT01.tif INPUT02.tif INPUT03.tif OUTPUT.pdf

Revision as of 21:02, 2 May 2012

Reduce the size of a PDF file consisting of scanned images

It is wise to scan documents at the highest resolution possible as downsampling can be done at any point. The fastest way I found so far the tools of the ImageMagick suite or with GhostScript.

Assuming we have a PDF with images scanned at 600dpi and I want to downsample it to 150dpi and use JPEG compression at a ratio of 80% for sending it via mail.

 convert -density 150 -compression jpeg -quality 80 INPUT.pdf OUTPUT.pdf

Convert images to PDF documents

Assuming you have a few images laying around that need to be converted to a PDF with a paper size in DIN A4.

convert -repage <format> -compress <algorithm> [-quality <quality in %>] INPUT.tif OUTPUT.pdf

The below example is with lossy JPEG compression at a compression ration of 80%. A higher number under quality yields a clearer image but requires more disk space. Note: the -quality option is optional but if you want to retain full control over the outcome I would suggest you use it.

convert -repage a4 -compress jpeg -quality 80 INPUT01.tif INPUT02.tif INPUT03.tif  OUTPUT.pdf

For lossless PDFs using the the TIFF format for stoage there are two options either LZW compression or ZIP. ZIP seems to be a bit more efficient. Note the -quality field is not required.

convert -repage a4 -compress lzw INPUT01.tif INPUT02.tif INPUT03.tif  OUTPUT.pdf

or

convert -repage a4 -compress zip INPUT01.tif INPUT02.tif INPUT03.tif  OUTPUT.pdf