Page 1 of 1

Page from PDF passed through stdin

Posted: 2007-07-06T14:03:35-07:00
by whirled
Hi,

I have a PHP script that generates a PDF document, then places that PDF into a string to pass to convert as stdin.

These PDFs are press quality, so they tend to be rather large. In order to show the user a low resolution GIF or JPG image I use the following command:

Code: Select all

convert -density 305 -resize 100% -profile 'USWebCoatedSWOP.icc' pdf:-[page#] -profile 'sRGB Color Space Profile.icm' -resample 72 gif:-
where page# is the page I want from the PDF.

This works fine if I only want the first page. If I do not specify a page, it returns the last page. My problem is that when I try to get a page other than the first or last, or I enter the last pages page number, I get an error.

Does anyone know if it is possible to specify the PDF page to convert if the PDF is passed through stdin? I would like to avoid using the PHP API for now if I can. However, I will be forced if someone knows if I can do what I need with the API, and not from the command line.

Any help with this would be greatly appreciated.

Thanks,

Re: Page from PDF passed through stdin

Posted: 2007-07-09T07:54:27-07:00
by whirled
I figured out what I was doing wrong, so I will post a reply to let anyone else who has this problem what I did wrong.

The page number should be specified after the output file, not the input file as I was doing.

Example:

Code: Select all

convert -density 305 -resize 100% -profile 'USWebCoatedSWOP.icc' pdf:- -profile 'sRGB Color Space Profile.icm' -resample 72 gif:-[page#]