1

I am trying to create virtual printer, which other application can print directly.

Here is the command line parameters

C:\Program Files\gs\gs9.53.3\bin\gswin64c.exe" -dBATCH -dSAFER -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dAutoRotatePages=/PageByPage -r600 -sOutputFile="%f" -

According to documentation this create pdf file in the output put path by
invoking the console Ghostscript interpreter, telling it to write PDF (-sDEVICE=pdfwrite) to the file chosen by Mfilemon (-sOutputFile="%f") reading its source from standard input (the final dash).

When I run a test page print or print few lines from text editor - The PDF file is created in the output directory but when I try to open PDF, it says - not supported file type or damaged

Any help to create a PDF file will be appreciated

Geo V
  • 121
  • 1
  • 10
  • 1
    What type of input is being sent to the pdfwrite device? This should be Postscript or PDF not text. A text type input should first be converted to Postscript or PDF. – beginner6789 Jan 24 '21 at 00:31
  • Thanks for the feedback, I tried converting print to file using Microsoft PS Driver and that got converted from the command line to a PDF gswin64c -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=C:\Cisco\test.pdf t2.prn -c quit – Geo V Jan 24 '21 at 01:30
  • The gswin64c should be able to open and display the t2.prn if that is good Postscript. If you can read Postscript then you could look inside the t2.prn to see what is happening. I am limited to Linux so don't know more about the Windows approach. – beginner6789 Jan 24 '21 at 01:53
  • t2.prn did convert to PDF and that worked fine. However on the Windows , there are no open source virtual printer which can print to .ps file to an output directory. If my application can print a postscript file, then it should work. – Geo V Jan 24 '21 at 21:50
  • Tested with our inhouse application and it creates a postscript file, conversion with PDF was successful but cannot search the pDF document, is there a switch to make it searchable – Geo V Jan 26 '21 at 00:27
  • I have the same problem, the output file is a PS file, not a PDF. I've gotten this working in the past, but not sure how. – whiskeychief Jul 21 '21 at 19:55
  • I think this is the same issue that I posted at SuperUser. https://superuser.com/questions/1467919/print-to-pdf-with-ghostscript-output-is-ps-not-pdf-using-mfilemon -- Output is PS, not PDF. – whiskeychief Jul 21 '21 at 19:58

0 Answers0