PDF printed as garbage with Brother printers

895 Views Asked by At

Possible Duplicate:
Delphi: How to print a PDF without showing it?

I am encountering different behavior while printing on different printers. On my printer the PDF print is correct but with "Brother" printers the same PDF is printed as gibberish (the content of the file gets printed). If the same PDF file is directly sent to printer using Adobe Reader, its printed correctly on the brother printer also.

To print the PDF file, I read the content in a TMemoryStream object using LoadFromFile function. The docinfo values specified are as below -

DocInfo.pDocName := pChar('My Document');
DocInfo.pOutput := Nil;
DocInfo.pDatatype := pChar('RAW');

After that Using the WritePrinter function, the command is sent to the printer handle.

Looks to me as if brother printer is not able to read the PDF encoding format.

Any help in this regard is appreciated.

P.S : My application is in Delphi4.

1

There are 1 best solutions below

2
On

WritePrinter is for sending raw printer specific data to a printer.

Some printers understand PDF, some don't.

You should have an application that understands PDF print it to the printer.

Many applications can do that, the most prominent of course Adobe Reader.

This answer shows three ways of doing that: Adobe Reader ActiveX, Adobe Reader application, GhostView/GhostPrint. It also references a few other ways.