Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Converting PDF to PostScript with GhostScript, Access is denied Unable to open command line file _.at

I installed ghostscript and updated the appropriate path variables ... however, I'm getting an error when I try to execute this command:

C:\PROGRA~1\gs\gs8.64\lib>pdf2ps mydocument.pdf mydocument.ps
Access is denied.
Unable to open command line file _.at

Is this the right command? Did I miss some configuration or path setting? Otherwise, is there a sane method of doing this conversion?

like image 201
Joel Martinez Avatar asked Nov 10 '09 21:11

Joel Martinez


4 Answers

Access is denied suggest something to do with access to paths etc. I'd suggest rechecking the folder permission (although I'm sure you've done that). Also, you might want to try running the gswin32c.exe instead of the pdf2ps to see if you still get the error, you might get something a little more specific.

gswin32c.exe ^
  -dNOPAUSE ^ 
  -dBATCH ^
  -sDEVICE=pswrite ^
  -sOutputFile=mydocument.ps ^
   mydocument.pdf
like image 158
Douglas Anderson Avatar answered Oct 03 '22 12:10

Douglas Anderson


Using pdf2ps runs a batch file, really named pdf2ps.bat or pdf2ps.cmd. You can easily look up and understand its "source code". If you do, you'll see it tries to write some of its commandline options into a temporary file named _.at, in order to overcome the 128 character limit for DOS/cmd commandline length that exist on some Win/DOS platforms.

Since you are invoking pdf2ps from the %programs% directory where Ghostscript is installed, you don't seem to be using an account that is permitted to write stuff in there. :-)

like image 27
Kurt Pfeifle Avatar answered Oct 03 '22 14:10

Kurt Pfeifle


With Ghostscript version gs9.10 the method pswrite didn't worked for me instead I tried using ps2write instead, and it worked for me, so the command worked for me is as below:

gswin32c.exe ^
  -dNOPAUSE ^ 
  -dBATCH ^
  -sDEVICE=ps2write ^
  -sOutputFile=mydocument.ps ^
   mydocument.pdf

and if this thing doesn't even works, then one can do this : try getting help by typing gswin32c.exe -h and then it will list all the available devices as shown below:

Default output device: display
Available devices:
   bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
   bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
   cp50 declj250 deskjet devicen display djet500 djet500c eps9high eps9mid
   epson epsonc epswrite ibmpro ijs inkcov jetp3852 jpeg jpegcmyk jpeggray
   laserjet lbp8 lj250 ljet2p ljet3 ljet3d ljet4 ljet4d ljetplus m8510
   mswindll mswinpr2 necp6 nullpage pamcmyk32 pamcmyk4 pbm pbmraw pcx16
   pcx24b pcx256 pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw pj
   pjxl pjxl300 pkmraw plan planc plang plank planm plib plibc plibg plibk
   plibm png16 png16m png256 pngalpha pnggray pngmono pngmonod pnm pnmcmyk
   pnmraw ppm ppmraw **ps2write** psdcmyk psdrgb pxlcolor pxlmono r4081 spotcmyk
   st800 stcolor svg t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc
   tiff32nc tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray
   tifflzw tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4
   tiffscaled8 tiffsep tiffsep1 txtwrite uniprint xpswrite
    Search path:
       C:\Program Files (x86)\gs\gs9.10\bin ;
       C:\Program Files (x86)\gs\gs9.10\lib ;
       C:\Program Files (x86)\gs\gs9.10\fonts ; %rom%Resource/Init/ ;
       %rom%lib/ ; c:/gs/gs9.10/Resource/Init ; c:/gs/gs9.10/lib ;
       c:/gs/gs9.10/Resource/Font ; c:/gs/fonts
    Initialization files are compiled into the executable.

As one can see only for the convenience only I have placed star(*) around the ps2write

like image 30
Rahul Gupta Avatar answered Oct 03 '22 13:10

Rahul Gupta


use gimp open PDF file.

file -> export -> postscript.

like image 24
kangear Avatar answered Oct 03 '22 12:10

kangear