Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

[11.07b2+D2010] ppArchiveReader + print to fax

edited March 2010 in General
Suppose we've a HP Laserjet set as default printer. Programmatically set the
device to fax for printing does not work:

This is the piece of code does not work:

with ppArchiveReader1 do begin
devicetype:=dtPrinter;
PrinterSetup.PrinterName:='My Fax printer name';
showmessage(PrinterSetup.PrinterName); <- this works as expected and the
'My Fax printer name' is shown on the screen
ShowPrintDialog:=true;
ModalCancelDialog:=true;
Print;
end;

calling the Print method the print dialog is shown but with the default
printer (HP Laserjet) ; setting ShowPrintDialog:=false, no print dialog is
shown and the output goes to the default (HP) no matter what printername
you've set.

Any workaround or solution?

Please help!!!

Max

Comments

  • edited March 2010
    > Any workaround or solution?


    problem solved through a workaround:

    var liPrinter: Integer; lPrinterDevice: TppPrinterDevice;
    begin
    lPrinterDevice:=TppPrinterDevice.Create(Self);
    lPrinterDevice.Publisher:=ppArchiveReader1.Publisher;
    lPrinterDevice.Printer.PrinterName:='My Fax printer name';
    lPrinterDevice.Printer.PrinterSetup.Copies:=1;
    ppArchiveReader1.PrintToDevices;
    lPrinterDevice.Free;
    end;

    Max
  • edited March 2010
    Hi Max,

    When manipulating the printer device while using the Archive Reader, you
    need to place all code inside the OnInitializePrinterSetup event. This will
    ensure all pages have the same printer information.

    It is also a good idea to use the PrinterSetup.PrinterNames property to
    define the printer name to be sure you have the correct one.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2010
    > When manipulating the printer device while using the Archive Reader, you

    ah ok, thanks for the suggestion. I'd rather think that Archive Reader's
    printer could be globally set in real time just like any normal report.


    yes, in my case i was using a name taken in real time from the
    printer.printers list, so there's no chance it was wrong. Indeed the
    PrinterSetup.PrinterName, shown using a showmessage after setting it, was
    correct, but the real print, nevetheless, was directed to the current
    default printer.

    Max
This discussion has been closed.