Wednesday 15 January 2014

Convert PDF to PCL using Ghostscript 9.15 -


Required to convert PDFs with a macro embedded (currently it is to test on Windows, however, Use in the application and print it from Unix) The macro will be used to embed this crop image in another document later and to print on the same page. I am using a PCL escape code to call macronumber and then the image will be printed. (You can see it in the form of a logo image.)

I am able to convert the generation to generation with PDF only without any white space using cropbox.

  "C: \ Prog ~ 1 \ Gus \ Gs9kl5 \ bin \ Gsvin64.akse" -o _sursepdfkroppedkpeedif \ -sdevike = Pdfwrite -k "[/ Kropboks [1140320 650] / Prishts pdfmark "\ -f_sourcePDF.pdf  

However, when I convert it to PCL _sourcePDFcropped.pdf , it still add whitespace is.

  "C: \ Prog ~ 1 \ Gus \ Gs9kl5 \ bin \ Gsvin64c.akse" -dbatc -dnopuse \ -sdevike = Pakslkolor -gl00x200 -soutputfile = _sursefedgrundkropdestkpakl \ -f _sourceFedGroundCropped.pdf  

I tried to use and it works because it is not very supportive, I am trying to use ghostscript.

  MKPCL.EXE -c4 -t -m 100 -p Image.jpg Image.MAC  

I also who have tried ImageMagick internal I'm guessing if I use the correct switch in GS, then I should be able to achieve my goal.

input PDF file:

PS: I've seen other PDF PSL questions on stack overflow, over the PCL with other PDF directly to crop my PDF output PCL

I have a sample input with the following command line PDF processed, using self-compiled Ghostscript v9.16 (unavailable from current GhostPDL GIT sources) By:

  GS-O - \ -sDEVICE = pdfwrite \ -c "[/ CropBox [1 140 320 650] / Prishts pdfmark" \ -f source.pdf \ \ | Gs -o tst.pcl \ -sDEVICE = pxlcolor \ -dUseCropBox \ -f -  

(As you might have seen well, I have a dump of 2 different ghostscript commands To avoid writing a temporary PDF file on the disk.)

If you want to do the same on Windows, then enter a cmd.exe in the command line / will DOS box:

  gswin64c.exe -o - ^ -sDEVICE = pdfwrite ^ -c "[/ Cropboks [1140320650] / Pejs pdfmark" ^ -f source.pdf ^ ^ | Gswin64c.exe -o tst.pcl ^ -sDEVICE = pxlcolor ^ -dUseCropBox ^ -f -  

Then I opened it with my own compiled PCL viewer (also from GhostPDL sources), << Code> pcl6 :

  pcl6 tst.pcl  

This is a pcl6 window showing screenshot:

pcl6-screenshot

Also known as Ken Is: It is important to use -dUseCropBox , when the process of generation PDF intermediate data!


No comments:

Post a Comment