Convert PDF to JPEG using Ghostscript

I use Ghostscript to convert my PDFs to JPEGs with Ghostscript, which works great.

For my output images, I use %03din the file name, so the file names come out 001, 002... etc. according to page numbers.

But I want, in some cases, the numbers start with a larger number.

For example, I process a file with two pages, so the output images page001.jpg,page002.jpg

Now I want to deal with the other PDF file and instead replace these files, I want to create page003.jpg, page004.jpg.

How can I do that?

This is my complete command line that I am using now:

'C:\gs\gs9.14\bin \gswin64c -dNOPAUSE -sDEVICE=png16m \
  -sOutputFile=page-%03d.jpg -r100x100 -q' . $pdf_file. '-c quit'
+4
2

, :

gswin64c.exe                  ^
   -sDEVICE=png16m            ^
   -sOutputFile=page-%03d.jpg ^
   -r100x100                  ^
   -c "showpage showpage"     ^
   -f filename.pdf

-c "showpage showpage" .

page-001.jpg + page-002.jpg + page-003.jpg + page-004.jpg

, .

, .


Update

, , PDF , , PDF , PDF , :

gswin64c.exe                  ^
   -sDEVICE=jpeg              ^
   -sOutputFile=page-%03d.jpg ^
   -r100x100                  ^
   -f file1.pdf               ^
   -f file2.pdf               ^
   -f file3.pdf               ^
   -f [...]

BTW, .jpg, Ghostscript - png16m. . , .

+2

Ghostscript, ( 10 , /NumCOpies 2, 0 19).

, , , , .

Ghostscript.

0

Source: https://habr.com/ru/post/1569683/


All Articles