setPrintFileName

setPrintFileName(name: String);

The setPrintFileName method of the Printer class requests the printer to write the print output to the file specified in the name parameter in the current directory.

In Jade thin client mode, this method always writes the print output to a file on the presentation client. This method is ignored if it is not called before the printer is opened.

It is the responsibility of the printer driver to format and create the output file from the print commands that are issued. Although this method may therefore not be supported by some printers, most postscript printers can create print files. If using Postscript printing, your printer must support Postscript level 2 or greater.

The type of file suffix that you specify is dependent on the type of print file created by your printer driver. For example, a printer driver may enable you to create a .prn print file.

The following example shows the use of the setPrintFileName method.

directTest();
vars
    report : ReportForm;
begin
    create report;
    report.tb1.formatOut := '';
    app.printer.setPrintFileName("TestFile.prn");
//  app.printer.setPrintFileName("FILE:");      // displays a dialog
    app.printer.print(report.directFrame);
epilog
    app.printer.close;
    delete report;
end;

If the name parameter is set to "FILE:", the Print To File dialog is displayed by the printer, enabling the user to specify the output file name that they require. (The Output File Name text box in this dialog also enables you to specify a valid existing path, if required; for example, d:\jade\MyFile.prn.)