Home Devices

Printer File functionality no longer working...

edited August 2011 in Devices
In version 10.06 I could call the following code and a .PRN file would
be generated that I could send via LPR straight to a printer withan LPD
server without having to install print drivers:

Report.DeviceType := 'Printer';
Report.ShowCancelDialog := False;
Report.ShowPrintDialog := False;
Report.AllowPrintToFile := True;
Report.PrinterSetup.FileName := 'C:\Test.prn';
Report.Print;


Now in the current release this functionality seems to be gone as the
same code prints to the default printer instead of creating the
C:\Test.prn file.

Was this functionality intentionally broken/deprecated? If so what is
the purpose of Report.PrintSetup.Filename?

How can I accomplish printing to a file that is a native printer (PCL)
file as I was able to do back in version 10.06?

--
Regards,
Branden Johnson
Integrity Software Design

Comments

  • edited August 2011

    The code works in my testing here, although in my test I wrote a .prn file
    to the My Documents folder. For the latest versions of Windows your app
    might not have security privileges to write to your specified location.

    You can trace the code in RBuilder\Source for ppPrintr.pas, the method
    TppCustomPrinter.BeginDoc. Put a stop in the following line. If this line
    assigns the file name, then it should work.

    if (FFileName <> '') then
    lDocInfo.lpszOutput := PChar(FFileName);


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.