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

Controlling the printer.

edited May 2007 in Devices
Hello.

I saw in you demo 123 that you can send multiple report in one print job
by using TppPrinterDevice.StartPrintJob and
TppPrinterDevice.EndPrintJob. Is there any way to send the print job to
the printer if we have set TppPrinterDevice.EndPrintJob to False before
printing the last report? I've tried TppPrinterDevice.EndJob but it
doesn't work.

Any ideas?

Comments

  • edited May 2007
    Hi Jean-Francois,

    I'm a bit unclear about what you are trying to accomplish. The idea of the
    StartPrintJob and EndPrintJob properties it to give you complete control of
    where and when a print job will start and end. If you have the EndPrintJob
    set to False, you can send a report to the printer however the job will not
    be closed and EndJob will not be fired. If you are for instance printing 3
    reports in a single print job you would want to do something like the
    following...

    StartPrintJob := True;
    EndPrintJob := False;
    Device.Publisher := Report1.Publisher;
    PrintToDevices; {Report1}

    StartPrintJob := False;
    EndPrintJob := False;
    Device.Publisher := Report2.Publisher;
    PrintToDevices; {Report2}

    StartPrintJob := False;
    EndPrintJob := True;
    Device.Publisher := Report3.Publisher;
    PrintToDevices; {Report3}

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Hello Nico.

    In the case that you don't know (or it's difficult to know) witch is
    your last report, is there any way to fire an EndJob manually ?

    There's my case. I print reports by taking in consideration some record
    in the database with a 'While not qry.Eof'. I only know that the last
    report has been printed when I get off the While, because the last
    iteration of the while will not produce a PrintToDevices (I email it
    instead for example). I don't have a reliable way to know when the last
    report is printed, so I can't set EndPrintJob = True when I print the
    last report. So far, I tried to put a Device.EndJob but I doesn't work;
    the job is sent when I close the application.

    JFPicard


  • edited May 2007
    Where are you calling the PrinterDevice.EndJob routine from? If you take a
    look at the TppPrinterDevice.EndJob routine you will see that it will not
    end the job unless the EndPrintJob property is set to True so you will need
    to be sure you set the property to True before calling the EndJob routine.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    I call it from the TppPrinterDevice.

    Here a example of the code that I try to do.

    lPrinterDevice.StartPrintJob := True;
    lPrinterDevice.EndPrintJob := False;
    lPrinterDevice.Publisher := RBReport.Publisher;


    while not qry.Eof do
    begin
    // Setting the whatever
    if Whatever then
    RBReport.PrintToDevices;

    lPrinterDevice.StartPrintJob := False;
    lPrinterDevice.EndPrintJob := False;
    qry.Next;
    end;

    lPrinterDevice.StartPrintJob := False;
    lPrinterDevice.EndPrintJob := True;
    lPrinterDevice.EndJob;

  • edited May 2007
    Hi Jean-Francois,

    After calling EndJob, try calling Printer.EndDoc manually to force
    ReportBuilder to end the document.

    lPrinterDevice.StartPrintJob := False;
    lPrinterDevice.EndPrintJob := True;
    lPrinterDevice.EndJob;
    lPrinterDevice.Printer.EndDoc;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Thanks Nico.

    It works fine.

    JFPicard

This discussion has been closed.