LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command line newbie needs help... (https://www.linuxquestions.org/questions/linux-newbie-8/command-line-newbie-needs-help-417062/)

Prince Myshkin 02-19-2006 01:19 AM

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:
Code:

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.

paulsm4 02-19-2006 01:47 AM

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):
Quote:

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

Quote:

pdfimages(1)

NAME

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

SYNOPSIS

pdfimages [options] PDF-file image-root

DESCRIPTION

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, image-root-nnn.xxx, where nnn is the image number
and xxx is the image type (.ppm, .pbm, .jpg)
.

CONFIGURATION FILE

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.

OPTIONS

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
option.

-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:
errQuiet]

-v Print copyright and version information.

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

EXIT CODES

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.

AUTHOR

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

SEE ALSO

xpdf(1), pdftops(1), pdftotext(1), pdfinfo(1), pdf-
fonts(1), pdftopbm(1), xpdfrc(5)
http://www.foolabs.com/xpdf/

24 March 2003 pdfimages(1)

mbreith 02-19-2006 03:03 AM

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

Quote:

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

Code:

pdfimages -f 9 -l 9 sample.pdf

kevkim55 02-19-2006 04:47 AM

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.


All times are GMT -5. The time now is 09:45 PM.