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

Printing page ranges using ExtraDevices

edited July 2007 in General
Hi all,

I have a report that is created at run-time (not an end-user report). There
is a button on the preview form to mass mail the pages of the report to
their respective addresses. What I need to do is traverse the report and
save the corresponding pages to a .pdf and then e-mail that as an
attachment. I have all of the logic worked out already, but I'm having a
problem specifying which pages to save to pdf. Ie. page 1 & 2 go to somebody
at somewhere.com, how can I tell the report to print just pages 1 & 2 w/o
using the print dialog?

Comments

  • edited July 2007
    Sorry, forgot to include the version.
  • edited July 2007
    Run RBuilder\Demos\Reports\Demo.dpr and check out demo 124 (dm0124.pas)

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2007
    I have been playing with that code, and I'm getting an AV for some reason.
    What am I missing?

    TppProducer(Report).AllowPrintToFile := True;
    TppProducer(Report).TextFileName :=
    ExtractFilePath(Application.ExeName)+'\DATA\REPORT.PDF';
    TppProducer(Report).DeviceType := 'PDFFile';
    TppProducer(Report).ShowPrintDialog := False;
    TppProducer(Report).FileDevice.PageSetting := psPageList; // AV Here
    *******

    // I switched the above line from PrinterDevice to FileDevice thinking
    that would be correct, but I am still getting and AV

    {note: this is a useful routine for converting the page list text
    to the list of strings}

    {print pages 1 and 3 }
    ppTextToPageList('1,3', TppProducer(Report).FileDevice.PageList, True);
    TppProducer(Report).Print;


  • edited July 2007
    Nvm, I've got it worked out. I had the code outside of the
    'beforeprint'...so, naturally it would cause an AV.
  • edited July 2007

    Note, in your code you do /not/ need to typecast Report as TppProducer.
    (TppProducer is the ancestor of Report, ArchiveReader, and the ClientReport
    included with RB Server Edition.)


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

    Best regards,

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