1
votes

Am having issues with printing different sized PDF's using GhostScript (V9.05).

The PDF in question is A3 landscape however when printing using ghost script using the following command line arguments the result is printed in A4 portrait and cuts off half of the content.

Commad line arguments:

"-sDEVICE=mswinpr2 -dPDFFitPage -dPrinted=false -dNoCancel -dBATCH -dNOPAUSE -sOutputFile="\spool\HP LaserJet P2050 Series PCL6 (A4)" "C:\Users\dmeggs\AppData\Local\Temp\iPlan_Printing_k4gjaoip.pdf""

I've tried many combinations of parameters, most seem to have no effect. Ideally I want the printer to print the PDF based on the PDF properties as this will be used to print A4, A3, portrait and landscape documents.

Thanks Dan

2

2 Answers

2
votes

Adding as a new answer as its too big for a comment.

If the output from pswrite and epswrite work then the printer is a PostScript printer.

Pdfwrite produces PDF files, so presumably you don't want to do that, given the input is a PDF file :-) Some PostScript printers can in fact print PDF files too, but this is comparatively unusual.

Rather than use psweite (or epswrite) I would suggest that you use ps2write (which will produce PostScript language level 2 as output) and send the resulting file to the printer.

In an ideal world your printer would then do media selection based on the media request in the PostScript program), but not all printers manage this. In part because printers don't always know which media is in which tray, if multiple media are available.

However, you can then write reasonably simple PostScript code which you can prepend to the file which will allow you to determine the requested page size. Assuming you know how to control tray/media selection in your printer you can have the PostScritp program do that for you.

Unfortunately I can't give you much detail on how to do this, as it depends a great deal on the specific printer.

2
votes

I presume the printer is an A4 printer ? In order for GS to scale the page correctly you need to tell it what the page size is. It can't tell from the printer name. Try setting -sPAPERSIZE=a4 -dFIXEDMEDIA

That sets the media to A4, and tells GS it can't be altered, the -dPDFFITPAGE switch will then fit the PDF media request to the declared media, by scaling.

If that doesn't work, then I'll need to see your PDF file.