Chen Chen
Chen Chen

Reputation: 182

GhostScript does not print PDF file to a real printer correctly, but works fine with PDFCreator

I'm trying to print a PDF file using GhostScript, with the following switches along with a valid input file path: -dPrinted -dNOPAUSE -dNoCancel -dNOPROMPT -dNOSAFER -sDEVICE=mswinpr2 -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=%printer%printerName

If I use PDFCreator, it works fine and gives another output pdf file. But when I use a real printer, the image is all messed up.

This is the file I'm trying to print: https://drive.google.com/file/d/0ByL_VDOdxc3MbmpocEo0Vnhhd2c/view?usp=sharing This is the scan of what came out of the printer: https://drive.google.com/file/d/0B_KRzl3VVurjaTVIbkhkaUc0Y1E/view?usp=sharing

The PDF file I'm trying to print is rendered by PDFSharp. I am using GS version 9.15 32-bit on Windows 8 and the real printer I'm using is Brother Printer, model MFC-7840W. Also when I try to print generic sample PDFs I find on Google to the real printer, it works fine.

Does anyone know what is causing this? Thanks in advance!

Upvotes: 1

Views: 2125

Answers (2)

Chen Chen
Chen Chen

Reputation: 182

It turns out to be an issue with the soft mask of the PDF file itself. This issue has been resolved in version 9.16 of GhostScript.

Upvotes: 1

KenS
KenS

Reputation: 31141

One of my colleagues has just reminded me that we ran across what 'might' be a related problem a few months back and suggested a workaround whic, I believe, resolved the problem in that case.

The mswinpr2 device includes a comment:

/* This driver uses the printer default size and resolution and
 * ignores page size and resolution set using -gWIDTHxHEIGHT and
 * -rXxY.  You must still set the correct PageSize to get the
 * correct clipping path.
 * The code in win_pr2_getdc() does try to set the printer page
 * size from the PostScript PageSize, but it isn't working
 * reliably at the moment.
 *
 * This driver doesn't work with some Windows printer drivers.
 * The reason is unknown.  All printers to which I have access
 * work.
 *
 * rjl 1997-11-20
 */

The important point is that you must set the PageSize (to get the clip correct) and also use the -g switch to set the width and height of the image (in pixels) and set the resolution correctly for the printer using -r. This might need some experimentation.....

You could also consider using gsprint, which is part of the current GSView. That has an updated version of the printing method (by the same author) which is claimed to be an improvement.

Upvotes: 0

Related Questions