Post Reply 

file-pdf-load in Windows

Feb 7, 2012, 09:27
Post: #1
file-pdf-load in Windows

Relatively new to GIMP but been playing with it for a couple of days and one thing is really frustrating me. I can't seem to open PDF's in batch mode via a script. JPG's are fine but PDF's just won't load, I always get:
"Execution error for procedure 'gimp-file-load':
Could not convert '1.pdf' to an URI: The pathname '1.pdf' is not an absolute path"

Tried this with file-pdf-load but get exactly the same error. Any ideas? Is this just a limitation of doing this in Windows?

Also, anyone know a way around using full file paths in windows? The \ aren't being picked up.


(define (batch-crop-jpeg)
(let* ((filelist (cadr (file-glob "*.pdf" 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-autocrop RUN-NONINTERACTIVE
image drawable)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Find all posts by this user
Quote this message in a reply
Feb 7, 2012, 12:18
Post: #2
RE: file-pdf-load in Windows
Hi, thanks for this.

That was the issue. I had tried the full file path before but \ didn't seem to be working. Resorted to using / instead and that works. Odd that it seems to work differently for PDF's than JPG's.
Find all posts by this user
Quote this message in a reply
Feb 7, 2012, 12:34
Post: #3
RE: file-pdf-load in Windows
It's going to be entirely dependent on the PDF file loader as that is what gimp-file-load uses.

By the way, if you're building the full file path yourself, then you should use the DIR-SEPARATOR constant and not explicitly use "/" or "\\" as DIR-SEPARATOR evaluates to the correct value dependant on the operating system and makes your code platform independent.
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  GAP Plugin error windows 8.1gap_ decode_mplayer.exe entry point not found. thegreenman 1 957 Sep 8, 2014 11:55
Last Post: rich2005
Question Load PDF and load images Vash Stampida 2 540 Aug 7, 2014 20:05
Last Post: Vash Stampida
  Windows 8, GIMP 2.8.10, crashes opening files or on new but will open by itself. Coanunn 2 396 Jul 29, 2014 13:57
Last Post: Coanunn
  How to get python module to load? Michael the Narwhal 0 827 Apr 16, 2014 16:49
Last Post: Michael the Narwhal
  Batch conversion of PDF file ? eljay 4 6,552 Oct 21, 2013 10:20
Last Post: almien

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS