Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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...?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.