Post Reply 

Batch conversion of PDF file ?

Dec 29, 2011, 11:30
Post: #1
Batch conversion of PDF file ?
I'm trying to develop a script-fu that would import a PDF file in non interactive mode and generate jpg images for each page. Problem is I couldn't find any example of how to script the PDF import function in batch mode.

Can somebody point me at some sample code or give me a hint on how do that ?

Thanks a lot for you help.

Eljay
Find all posts by this user
Quote this message in a reply
Dec 30, 2011, 12:38
Post: #2
RE: Batch conversion of PDF file ?
@eljay
When I saw your post, first thought was Imagemagick, but then howto implement in script-fu, Don't know.

The basic IM comand is trivial

convert filename.pdf[n] filename.ext

where n is a page number starting at 0 (= page no.1)

I would use a bash file to loop through the pages as I don't do any script-fu or python.

A quick search, nothing on script-fu but maybe be possible in python.

Here is a plugin that calls IM from gimp - long shot but maybe a starting point.

http://www.mm-log.com/blog/2010-01-21/us...ithin-gimp

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Dec 30, 2011, 14:18
Post: #3
RE: Batch conversion of PDF file ?
Thanks for your suggestion of using IM to do the job. This is actually what we use right now. However we noticed that in many cases Gimp does a much better job at converting PDF files to Jpeg than IM does. We tried hard to fine tune the various options of the IM convert tool but rarely achieved as good results as Gimp.

Hence my question and the idea of scripting Gimp
Find all posts by this user
Quote this message in a reply
Dec 30, 2011, 20:57
Post: #4
RE: Batch conversion of PDF file ?
Ah nice !
I kew ghostscript was used both by IM and Gimp but didn't known which ghostscript command line to use. I'm going to try this one right away. Thank you !
Find all posts by this user
Quote this message in a reply
Oct 21, 2013, 10:20
Post: #5
RE: Batch conversion of PDF file ?
(Dec 30, 2011 16:54)ofnuts Wrote:  Gimp (or IM) will not give you anything better than what GhostScript produces directly since in this case they are only the middle men. On a PDF I have, this:
Code:
ghostscript -dSAFER -dBATCH -dNOPAUSE -r300 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sDEVICE=png16m "-sOutputFile=OPA%02d.png" OPA2134-Datasheet.pdf

Just to add a note for anyone trying this on Windows - the % needs to be escaped as %% in any batch files (otherwise it will interpret OPA%02d.png as "OPAC:\batchfile.bat.png")
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Script-fu script to conversion pdf to image 4ever 12 10,782 Jul 17, 2018 16:01
Last Post: paynekj
  Script-fu ordered file list vnicent 1 325 Mar 19, 2018 17:33
Last Post: paynekj
  Batch create images from array edmilner 1 707 Jul 17, 2017 16:41
Last Post: ythgilb
  How to close gimp with batch command? flixe 1 752 Jun 19, 2017 12:29
Last Post: ythgilb
  Bashing my head - Batch Python Script nmiltner 1 815 Sep 5, 2014 00:58
Last Post: nmiltner

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS