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

ppViewer - Printer Setup

edited April 2011 in End User
Hi

I have a form with a ppViewer to display pre prepared reports, also on
the form is a Printer Set up Dialog. If I select the button to show
Printer Setup then this correctly shows the default printer with
papersize A4 an source Tray 3.

If I load an archive file into the viewer, using the code below and then
call ppViewer1.Print a printer dialogue is displayed, however if I
select the Properties button next to the printer this shows an erroneous
Paper Size (Custom Size 10) and erroneous Paper Source. This then
generates a dialoge which says 'An unsuitable setting item was found the
following setting has been modified Paper Source => Auto'.

The printer is a Konica Minolta C250/C250P PCL

Where does the Viewer get its printer settings from and how can I force
them to be those of the default printer?

Thanks in advance

Philip L Jackson




code to load raf file into viewer

plCopyInvoice.DataSource :=
winFinance.InvoiceDataSource1;
DBArchiveReader.DatabaseSettings.BLOBField :=
'INVOICE_RAF';
DBArchiveReader.DatabaseSettings.NameField :=
'INVOICE_NO';
DBArchiveReader.DatabaseSettings.Name :=
winFinance.InvoiceTable.FieldByName('INVOICE_NO').value;
ppviewer1.report :=
DBArchiveReader;
ppViewer1.RegenerateReport;

Comments

  • edited April 2011
    Hi Philip,

    The viewer itself only shows report pages, it does not handle printing.
    When you make a call to TppViewer.Print, it in turn calls the print
    function of the producer (which in your case is the DBArchiveReader).
    This will then use the PrinterSetup settings that were defined when the
    archive was created.

    If you would like to change these settings, you will need to use the
    OnInitializePrinterSetup event of the ArchiveReader to do so in code.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Hi
    Hi


    Any chance of a pointer to how I use OnInitializePrinterSetup? Is it in
    the help files or on rbWiki?

    Thanks

    Philip L Jackson


  • edited April 2011
    Hi Philip,

    We do not have any examples of using this particular event however this
    is the event that you want to use if you make any changes to the
    PrinterSetup property when printing an archive. It is necessary due to
    the fact that the PrinterSetup is saved down with each page of an
    archive and this event fires at the proper time before each page has
    printed to override it.

    Something like the following...

    uses
    Printers, ppTypes;

    ...
    procedure TForm1.ppDBArchiveReader1InitializePrinterSetup(Sender: TObject);
    begin

    ppDBArchiveReader1.PrinterSetup.PrinterName :=
    ppDBArchiveReader1.PrinterSetup.PrinterNames[0];
    ppDBArchiveReader1.PrinterSetup.PaperName :=
    ppDBArchiveReader1.PrinterSetup.PaperNames[0];
    ppDBArchiveReader1.PrinterSetup.BinName :=
    ppDBArchiveReader1.PrinterSetup.BinNames[0];
    ppDBArchiveReader1.PrinterSetup.Orientation := poLandscape;
    ppDBArchiveReader1.PrinterSetup.Copies := 2;
    ppDBArchiveReader1.PrinterSetup.Duplex := dpHorizontal;

    end;


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.