I've a problem with that command line :
gswin32c.exe -sDevice=pdfwrite -sOutputFile=out.pdf -dNOPROMPT -dNODISPLAY -dNOPAUSE doc.prn-q -c quit
The program runs without any error.If I enable the display option, i can see the Ghostscript image of my document but my PDF is not generated.
Any Ideas ?
Solved
gswin32c -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=doc.pdf doc.prn -c quit
Your command line includes 'doc.prn-q' possibly you meant 'doc.prn -q'. Hint, if you are trying to debug a problem, don't turn off all the messages which might be trying to give you information! (-q is 'quiet' mode).
I finally found the solution, maybe parameters where not well placed in my command line.
gswin32c -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=doc.pdf doc.prn -c quit
Thank you for all guys !
Have a nice day
Fabien
Related
I have been using this file for quite some time, today it stopped working:
C:\"Program Files"\gs\gs9.53.2\bin\gswin64 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dPrinted=false -dPassThroughJPEGImages=false -dDownsampleColorImages=true -dColorImageResolution=400 -dDownsampleGrayImages=true -dGrayImageResolution=400 -dDownsampleMonoImages=true -dMonoImageResolution=400 -dNOPAUSE -dBATCH -sOutputFile=FalterinLenzkirchV2_Compressed.pdf FalterInLenzkirchV2.pdf
I am very surprised; the error message is
'pdfwrite' requires an output file but no file was specified
The output file is there
Since this a batch sript not being changed, I wonder what else has changed which I am not aware of?
"C:/Program Files/gs/gs9.53.2/bin/gswin64c.exe" -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dPrinted=false -dPassThroug hJPEGImages=false -dDownsampleColorImages=true -dColorImageResolution=400 -dDownsampleGrayImages=true -dGrayImageResolution=400 -dDownsampl
eMonoImages=true -dMonoImageResolution=400 -dNOPAUSE -dBATCH -sOutputFile=annots.pdf examples/annots.pdf
WORKSFORME -- Please try with that input file, and if that doesn't work we will need to get your input file.
I'm using Ghost Script to operate PDF. I'm using numered variables as arguments. My input file name is "x.pdf". I want the output file to be "x-processed.pdf". Curently I have the above mentrioned code:
gswin64c.exe -q -dNOPAUSE -dBATCH -dSAFER -dPDFA=2 -dPDFACompatibilityPolicy=1 -dSimulateOverprint=true -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dAutoRotatePages=/None -dColorImageDownsampleType=/Bicubic -dColorImageResolution=150 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=150 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=150 -sOutputFile=%1%-processed.pdf -c .setpdfwrite -f %1
So the output file name is currently inputfilename.pdf-processed.pdf.
I want to remove that extension. But I can't figure out how.
I've tried to use variable substitutions form here: http://cplusplus.bordoon.com/cmd_exe_variables.html
That is to say, I've changed -sOutputFile=%1-processed.pdf to -sOutputFile=%~pn1-processed.pdf
That did not work.
So I've tried to look how to use these substitutions at first place. I've tried to copy selected file name to the clipboard by adding this command via regedit:
cmd.exe echo "%~n1"|clip
That does not work.
But if I put simply:
cmd.exe /c echo "%1"|clip
That works properly and copy file path with extention to the clipboard.
I'm really stuck as I don't understand what I'm doing wrong here. Please help me.
No error messages. No messages at all. Nothing happens.
In fact there is only few variables available when wring a shell command from context menu.
More info is in https://superuser.com/a/473602.
So the only way is to create a batch file with the above mentioned code:
C:\Program Files (x86)\gs\gs9.27\bin\gswin32c.exe" -q -dNOPAUSE -dBATCH -dSAFER -dPDFA=2 -dPDFACompatibilityPolicy=1 -dSimulateOverprint=true -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dAutoRotatePages=/None -dColorImageDownsampleType=/Bicubic -dColorImageResolution=150 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=150 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=150 -sOutputFile="%~dpn1-processed.pdf" -c .setpdfwrite -f "%~1"
And add the following command REG_SZ line instead of putting the command directly:
"Path_to_bat_file/file_name.bat" "%1"
And it should work.
I often use the following command to merge PDFs:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=output_name.pdf /location/of/plots/*.pdf
I tried setting up an equivalent function in my .bashrc file:
function(){
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=$1 $2
}
Now, $ function output.pdf input.pdf only takes one input. How can I change that? Ideally I'd like to be able to pass *.pdf as input.
The following function works fine for me:
pdf_merge() {
output=$1
shift
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="$output" "$#"
}
I am running with crazy issue in ghostscript 9.15.I have two commands for converting PDF to JPEG images,which has difference in height and width only.
Command 1st
-q -dUseCropBox -dBATCH -dDOINTERPOLATE -dMaxBitmap=300000000 -dAlignToPixels=0 -dNOPAUSE -dSAFER -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage -dPrinted=false -r144 -g200x200 -sDEVICE=jpeg -dJPEGQ=100 -sOutputFile="output.jpg" "input.pdf" -c quit
Command 2nd
-q -dUseCropBox -dBATCH -dDOINTERPOLATE -dMaxBitmap=300000000 -dAlignToPixels=0 -dNOPAUSE -dSAFER -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage -dPrinted=false -r144 -g200x199 -sDEVICE=jpeg -dJPEGQ=100 -sOutputFile="output.jpg" "input.pdf" -c quit
As you can see, command has difference in -g parameter only.
In first command I have used -g200x200 and in second command -g200x199.
First command gives rotated JPEG while second command gives UN-rotated JPEG file.Is there any utility inside ghostscript which differentiate my command from height and width perspective.
How should I get UN-rotated JPEG image file by using same height and width(-g200x200) while converting PDF to JPEG image file ?
The main answer is 'don't use PDFFitPage'. That feature automatically rotates the output to fit 'best' on the declared media. If that isn't an option then you will have to do some PostScript programming.
You can fnd the code which does the resizing (and rotation) in ghostpdl/gs/Resource/Init/pdf_main.ps, the function /pdf_PDF2PS_matrix
Having difficulties with Imagemagick and Snow Leopard.
Imagemagick was installed using the install script from here here. Everything builds and installs correctly. Imagemagick behave normally for all commands (that I can find) except when trying to convert a PDF. For example,
$ convert my.pdf my.jpg
Segmetation Fault
I thought it may be ghostscript and tried to run the command that Imagegick delegates too (via the -verbose option)
$ convert -verbose spec/fixtures/documents/upload_test_file.pdf test.jpg
"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-4zvJXfSz" "-f/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-O7a9fDyp" "-f/var/folders/Xz/Xz6TDr0DFQaV5J1F7Ndamk+++TM/-Tmp-/magick-rBEzLUsx"
Segmentation fault
$ "gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=my.jpg" "-fmy.pdf"
And it works. It creates the pnmrow file as its supposed to.
I am not sure where to go from here, anyone else seen this or seen it and solved it?
me too.
$ identify issue7.pdf
Segmentation fault
Looks like the imagemagick team is aware of the problem and it should be fixed in version 6.5.5-8.
UPDATE: Actually - The MacPorts package uses the newer version of ImageMagick as of 9/16/09. Try doing a self update and then upgrading php5-imagick.
sudo port selfupdate
sudo port upgrade php5-imagick
This fixed the problem for me.