Modifying a PDF mod to work for Windows Modifying a PDF mod to work for Windows
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Modifying a PDF mod to work for Windows

Started by andreyman3d2k, October 27, 2009, 05:45:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

andreyman3d2k

I think this may be a really simple question for anyone familiar with ghostscript/PHP

I am trying to implement this mod:

http://forum.coppermine-gallery.net/index.php?topic=16986.0

I got it to work, except for the last step, which uses ghostscript to generate thumbnails. The mod is written for Linux, and I am using Windows. I am wondering if anyone could make the appropriate changes in the code to make it work? Please visit the above link (it is a very short read) and jump to step 3.

I though I just needed to change the path for ghostscript for Windows, but when I changed it to

C:\\Program Files\\gs\\gs8.70\\bin\\gswin32.exe

I still get this error:

Error 1 on command 'C:\Program Files\gs\gs8.70\bin\gswin32c.exe -sDEVICE=jpeg -dNOPAUSE -dBATCH -sOutputFile='albums/edit/pdftmp.filename.pdf.%d.jpg' 'albums/userpics/10001/filename.pdf''

(BTW if I comment out that code, the PDF upload works fine -- just no thumbnail).

I am very new to this, so any help would be greatly appreciated. Thank you very much!

Andrey

Joachim Müller

Did you check the Windows flavor of Ghostscript: does it accept the same parameters that the Unix version accepts? And are you sure that you need gswin32.exe and not gswin32c.exe ? And finally: have you read the board rules that you agreed to respect when signing up? It doesn't seem so. Please do so now and submit the missing details.

andreyman3d2k

Thanks for the reply!

To answer your questions:
"are you sure that you need gswin32.exe and not gswin32c.exe?"

I tried both, same results

"Did you check the Windows flavor of Ghostscript: does it accept the same parameters that the Unix version accepts?"

I know nothing about ghostscript -- found out about its existence by trying to use this mod. I will try to find out about the parameters, but not even sure where to look.

"have you read the board rules that you agreed to respect when signing up? It doesn't seem so. Please do so now and submit the missing details."

I re-read the rules -- I am not sure which particular one I violated that you are referring to. I am not sure what details to provide, because, being new to this, I am not sure what is relevant and what isn't (I could paste all the code for the site, but that would obviously be counter-productive) . I will be happy to supply any details that I can, just let me know what it is (I will probably ask where to find it).

If you are referring to posting a link to the gallery -- Unfortunately I cannot do that, because I am running the site on a WAMP test server all on my computer -- it isn't actually online.

Thanks again for the quick reply, and any additional help.


Stramm

For the path try
C:/Program Files/gs/gs8.70/bin/gswin32.exe

/ instead of \

andreyman3d2k

Thanks for the suggestion, I tried the different slashes, still not luck.

Just to point out, the error message contains this part:

-sOutputFile='albums/edit/pdftmp.Acrobat_9_Exam~12.pdf.%d.jpg'

is that definitely correct, or that %d supposed to be changing the .pdf to the .jpg?

Also, when I just open ghostscript and type, for example, -sDEVICE=jpeg

it says Error: /undefined in -sDevice=Jpeg

Does that mean anything?

andreyman3d2k

also, I found this on the Web, per Joachim Müller's suggestion to search for platform notes (again, I am very new to programming, so I am not sure if this is relevant, but might be):

The name of the Ghostscript command line executable on MS Windows is gswin32c so use this instead of the plain 'gs' in the quickstart examples.

To run the batch files in the ghostscript lib directory, you must add gs\bin and gs\lib to the PATH, where gs is the top-level Ghostscript directory.

When passing options to ghostcript through a batch file wrapper such as ps2pdf.bat you need to substitute '#' for '=' as the separator between options and their arguments. For example:

ps2pdf -sPAPERSIZE#a4 file.ps file.pdf
Ghostscript treats '#' the same internally, and the '=' is mangled by the command shell.
There is also an older version for MS Windows called just gswin32 that provides its own window for the interactive postscript prompt. The executable gswin32c is usually the better option since it uses the native command prompt window.

For printer devices, the default output is the default printer. This can be modified as follows.

-sOutputFile="%printer%printer name"
Output to the named printer. If your printer is named "HP DeskJet 500" then you would use -sOutputFile="%printer%HP DeskJet 500".

----------

I found this at:

http://pages.cs.wisc.edu/~ghost/doc/cvs/Use.htm#MS_Windows

andreyman3d2k

Okay, I think I pinned down the problem -- the ghostscript itself isn't working.
Everything I type into the ghostscript console gives the "/undefined in [whatever I type]" error.

For example:

-sDEVICE=jpeg -sOutputFile=foo.jpg foo.ps

gives:

Error: /undefined in -sDEVICE=Jpeg

I am running this on Windows XP, Ghostscript 8.70 (tried downloading earlier version 8.63, same result)

I know this is probably way outside the scope of this forum, but I can't find the answer anywhere. If anyone has a clue or suggestion, please post!

thank you!