Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-19-2006, 01:19 AM   #1
Prince Myshkin
LQ Newbie
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu, Suse
Posts: 6

Rep: Reputation: 0
Command line newbie needs help...

...with syntax. I'm just not grokking it.

I'm trying to use pdfimages to extract an image from a pdf file.
In this case the file is called sample.pdf & I want to extract page 9 from the file.
pdfimages says:
Usage: pdfimages [options] <PDF-file> <image-root>
  -f <int>       : first page to convert
  -l <int>       : last page to convert
  -j             : write JPEG images as JPEG files
  -opw <string>  : owner password (for encrypted files)
  -upw <string>  : user password (for encrypted files)
  -q             : don't print any messages or errors
  -cfg <string>  : configuration file to use in place of .xpdfrc
  -v             : print copyright and version info
  -h             : print usage information
  -help          : print usage information
  --help         : print usage information
  -?             : print usage information
So I would type:
pdfimages [-f9 -l9] sample.pdf...? I don't understand the <image-root> part. If some one could give me a proper example (explanations optional) it would be of great help.
Old 02-19-2006, 01:47 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Below is the "man" page for pdfimages. It sounds like your suggested syntax is correct, and that "image-root" simply specifies what your output file is going to be called.

I'd suggest trying this (assuming you haven't already):
pdfimages -f 9 -l 9 sample.pdf test
I'd also suggest looking for a "/usr/local/etc/xpdfrc" configuration file to control what the output format will be.

'Hope that helps .. PSM



pdfimages - Portable Document Format (PDF) image extractor
(version 2.02)


pdfimages [options] PDF-file image-root


Pdfimages saves images from a Portable Document Format
(PDF) file as Portable Pixmap (PPM), Portable Bitmap
(PBM), or JPEG files.

Pdfimages reads the PDF file, scans one or more pages,
PDF-file, and writes one PPM, PBM, or JPEG file for each
image,, where nnn is the image number
and xxx is the image type (.ppm, .pbm, .jpg)


Pdfimages reads a configuration file at startup. It first
tries to find the user's private config file, ~/.xpdfrc.
If that doesn't exist, it looks for a system-wide config
file, typically /usr/local/etc/xpdfrc (but this location
can be changed when pdfimages is built)
. See the
xpdfrc(5) man page for details.


Many of the following options can be set with configura-
tion file commands. These are listed in square brackets
with the description of the corresponding command line

-f number
Specifies the first page to scan.

-l number
Specifies the last page to scan.

-j Normally, all images are written as PBM (for
monochrome images) or PPM (for non-monochrome
images) files. With this option, images in DCT
format are saved as JPEG files. All non-DCT images
are saved in PBM/PPM format as usual.

-opw password
Specify the owner password for the PDF file. Pro-
viding this will bypass all security restrictions.

-upw password
Specify the user password for the PDF file.

-q Don't print any messages or errors. [config file:

-v Print copyright and version information.

-h Print usage information. (-help and --help are


The Xpdf tools use the following exit codes:

0 No error.

1 Error opening a PDF file.

2 Error opening an output file.

3 Error related to PDF permissions.

99 Other error.


The pdfimages software and documentation are copyright
1998-2003 Glyph & Cog, LLC.


xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdf-
fonts(1), pdftopbm(1), xpdfrc(5)

24 March 2003 pdfimages(1)

Last edited by paulsm4; 02-19-2006 at 01:50 AM.
Old 02-19-2006, 03:03 AM   #3
Registered: Feb 2006
Location: oregon
Distribution: PIII fedora2 | P4 fedora2 | Thinkpad fedora2
Posts: 54

Rep: Reputation: 15
I don't know what image-root means either. Be sure to leave out the [ ] when giving commands. Those are descriptions in the syntax line. I think they mean that the options in the brackets are optional. Also be sure to leave a space between option flags and option arguments

So I would type:
pdfimages [-f9 -l9] sample.pdf...?
would become

pdfimages -f 9 -l 9 sample.pdf
Old 02-19-2006, 04:47 AM   #4
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
image root specifies the basename of your output file. For eg. if you want the images to be called as my-pic-1.jpg, my-pic-2.jpg..... , you would specify my-pic as the image-root which, pdfimage would use and append the numbers and extension to it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
command line newbie help! -renaming files. mifan Programming 5 09-01-2005 06:06 AM
newbie questions about the command line sether *BSD 12 09-04-2004 01:40 PM
Newbie: Stuck at command line. BoardinBum Slackware 9 08-14-2004 02:40 PM
Another Newbie Question - Command Line Shortcuts? AtomiCTheGr8 Linux - General 9 08-14-2002 09:02 PM
Command Line Newbie mrozkan Linux - General 6 01-27-2002 12:41 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration