This tutorial contains instructions about converting PDF into bitmap image (jpeg & png). The instructions consist of pdftoppm command lines. Fortunately, pdftoppm command (packaged in poppler-utils package) is already included built-in since Ubuntu 12.04 and above. Thanks to Poppler Project (http://poppler.freedesktop.org) and Glyph & Cog (http://www.glyphandcog.com) for providing this pdftoppm utility.
Summary
We give command line syntax below with this single example of usage. We use a 8 pages long PDF magazine as example here.
- Syntax: pdftoppm -png -f 1 -singlepage <pdf_filename> <image_name>
- Example: pdftoppm -png -f 1 -singlepage rootmagz-042015.pdf mycoverpage
1. Convert First Page
pdftoppm -png -f 1 -singlepage <pdf_filename> <image_name> pdftoppm -jpeg -f 1 -singlepage <pdf_filename> <image_name>Explanation: first command will export to png, while second will export to jpeg. Both will export only the first page.
2. Convert Selected Pages
pdftoppm -png -f 1 -l 4 <pdf_filename> <image_name> pdftoppm -jpeg -f 1 -l 4 <pdf_filename> <image_name>Explanation: both will export 1-4 pages. Option -f (first) and -l (last) should be used for page range.
3. Convert All Page
pdftoppm -png <pdf_filename> <image_name> pdftoppm -jpeg <pdf_filename> <image_name>Explanation: both will export all pages, png and jpeg, respectively.
4. Adjust DPI Quality to Conversion
pdftoppm -png -f 1 -singlefile -r 300 <pdf_filename> <image_name> pdftoppm -png -f 1 -singlefile -r 50 <pdf_filename> <image_name>
Explanation: first command will export first page with 300 dpi quality, while second will export with 50 dpi.
5. Convert Only All Odd Pages
pdftoppm -jpeg -o <pdf_filename> <image_name>
Explanation: this will only export odd pages (i.e. 2, 4, 6, 8).
6. Convert Only All Even Pages
pdftoppm -jpeg -e <pdf_filename> <image_name>
Explanation: this will only export even pages (i.e. 1, 3, 5, 7).