creating a binary print file for archive reader
I am trying to take a previously archived file and create a binary print
file file using a different printer than the current windows default
printer or the printer that was used to create the archive.
This is the pseudo code I am using:
ppa.devicetype := 'PrinterFile';
ppa.archivefilename := 'c:\archived file';
ppa.textfilename := binary filetocreate;
ppa.showprintdialog := false;
ppa.printer.printername := "print driver to use";
ppa.print;
ppa.showprintdialog := true;
it creates the binary file but not with the selected printer
Help
Dennis McGuire
PCFS2000
file file using a different printer than the current windows default
printer or the printer that was used to create the archive.
This is the pseudo code I am using:
ppa.devicetype := 'PrinterFile';
ppa.archivefilename := 'c:\archived file';
ppa.textfilename := binary filetocreate;
ppa.showprintdialog := false;
ppa.printer.printername := "print driver to use";
ppa.print;
ppa.showprintdialog := true;
it creates the binary file but not with the selected printer
Help
Dennis McGuire
PCFS2000
This discussion has been closed.
Comments
When changing the printer setup in the archive reader, you need to use the
TppArchiveReader.OnInitializePrinterSetup event to do so. This will ensure
that the correct printer setup options will be used for every page in the
archive.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
procedure TBankoBicform.ppAInitializePrinterSetup(Sender: TObject);
begin
ppa.printersetup.printername := allglobal^.GLOBALopticalprinter;
end;
But it still doesn't work when you print to a file - seems to still go to
current windows printer driver
When setting the printer name, you need to have the exact printer name used
by the printer device for it to work. The best way to ensure you use the
right name is to select the printer name from the
Report.PrinterSetup.PrinterNames TStrings object.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
When selecting a different printer using the PrinterNames property, does it
still print to the default printer? How about when selecting a printer
manually using the Object Inspector?
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
If you print to a file it seems to allways use the default windows printer
Sorry for the delay in this response. After your first post, I failed to
see that you were setting your Report.DeviceType to PrinterFile rather than
Printer. PrinterFile is an TExtraDevices device that I assume tries to
print a report to a .prn file. I am however not sure how this device
selects the printer to use to create this file.
To print to a .prn file using ReportBuilder, simply set your
Report.DeviceType to Printer, then set the Report.PrinterSetup.FileName to
the name of the file you would like to print to. Using the selected
printer, ReportBuilder will then print to the file you define.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
printer driver but instead of going to a file it actually prints
ppa.devicetype := 'Printer';
ppa.archivefilename := trim(globalpath) + 'Reports\' +
sbadatamodule2.pastreportsfilename.value;
ppa.PrinterSetup.FileName := filetocreate;
ppa.showprintdialog := false;
ppa.printer.printername := allglobal^.GLOBALopticalprinter;
ppa.print;
ppa.showprintdialog := true;
Thanks in advance
Dennis McGuire
Again I must apoligise for not realizing you were using an ArchiveReader
rather than a Report object. When using the ppArchiveReader, you need to
use the OnInitializePrinterSetup event to set any PrinterSetup properties.
Move the "ppa.PrinterSetup.FileName := FileToCreate;" line inside this
event and the problem should be fixed.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com