Dr. Fabien Tarrade
Dr. Fabien Tarrade

Reputation: 1706

PDF to PNG conversion using Ghostscript: only the fist page is in the output PNG file

I am using Ghostscript on Windows 7 machine to convert PDF to PNG. My input PDF has many pages but the PNG file only contain the first page !

I am using the following command line:

gswin64c  -sDEVICE=png16m -r720x720 -dNOPAUSE -dBATCH -sOutputFile=79245340005_1602.png  79245340005_1602.pdf

and the logfile is as follow:

GPL Ghostscript 9.20 (2016-09-26)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Page 2

As you can see, it seems that both pages are processed but only the first one appear in the final PNG file. Any idea what is wrong in my command line ? I try to look a the documentation but didn't find what I am doing wrong. If I have a single PDF file with 10 pages, I wand a single output PNG file with 10 pages.

My original command line was as follow but had the same issue:

gswin64c -q -sPAPERSIZE=a4 -sDEVICE=png16m -dTextAlphaBits=4 -r720x720 -o 79245340005_1602.png -dNOPAUSE -dBATCH  79245340005_1602.pdf

Thanks Fabien

Upvotes: 1

Views: 2807

Answers (2)

lerthe61
lerthe61

Reputation: 367

Try to use following syntax to achieve rasterizing into several png's

gswin64c -q -sPAPERSIZE=a4 -sDEVICE=png16m -dTextAlphaBits=4 -r720x720 -o -sOutputFile='79245340005_1602_%00d.png' -dNOPAUSE -dBATCH  79245340005_1602.pdf

Upvotes: 2

Chris Treber
Chris Treber

Reputation: 26

PNG can hold only one image per file. Use TIFF or the like for multiple images per file.

Upvotes: 1

Related Questions