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

Getting a "snapshot" of a report

edited November 2004 in General
My app is going to have the facilty for the user to take a snapshot screen
shot of a report page so that it can be later displayed as a thumbnail when
browsing the available reports. I want a largeish jpeg so they can enlarge
to full size if they wish.

My first thought was to copy the image from the TppViewer.Canvas and this
worked but it was only as large as the current screen could hold, not really
high enough res. Then I tried to dynamically create another TppViewer and
set its size to larger than the screen but when I used Canvas.CopyRect I
ended up copying things like the Windows taskbar just as if it were a screen
shot and the bit off the screen was blank.

My other idea is to use TExtraOptions from waler.com as this can save to a
graphic file. This creates one graphic file per page though and I only need
one page.

So my question is how can I tell it to just print a certain page number only
without using the print dialog ?

Or does anyone have better ideas as to how to do this ?

Thanks

Comments

  • edited November 2004
    Hi Andrew,

    Check out demo 124 located in the \RBuilder\Demos\1. Reports\... directory
    (dm0124.pas). This demo shows how to send a given page or pages to the
    print device at the time of printing.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2004
    Thanks I got this working with the following code but it only works
    correctly when going to a real printer. If I set Report.DeviceType :=
    'GraphicFile' (using TExtraOptions from waler.com) it still sends ALL of the
    pages to graphic files when I only want one page.

    Any more ideas ?

    procedure Tform_report_viewer.ReportBeforePrint(Sender: TObject);
    begin
    Report.PrinterDevice.PageSetting := psPageList;

    // Example just print page 2
    ppTextToPageList('2', Report.PrinterDevice.PageList, True);
    end;



  • edited November 2004
    Hi Andrew,

    I'm unsure how TExtraDevices works for this type of export. Each device
    should descend from the TppDevice class and override the ReceivePage method.
    Using the method I gave you, you are only sending one page to the device
    therefore should only see one page in the output. You may want to send an
    email to Waler and see if they know anything about this issue.

    --
    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.