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

Displaying a Graphic from a Delphi Component

edited January 2008 in General
Is there a way of making a graphic on a form available to print in
ReportBuilder?

I am using a signature pad from TopazSystems.com. Their graphic of the
signature is saved as an ASCII text string and contains biometric data in
addition to the graphic. It would be preferable for me to save only this
ASCII text string and then be able to have ReportBuilder print the signature
graphic on a contract, rather than saving bitmap graphics as well as the
string versions of the signature. I can't figure out how to get the graphic
over to ReportBuilder.

ReportBuilder Enterprise 10, Delphi 2007

Comments

  • edited January 2008
    Hi David,

    I'm unclear about what type of "graphic" needs to be displayed. What format
    is this graphic in? Does the ASCII text you mention represent some sort of
    in-house graphic type used by the signature pad application? If so, you
    would need to create your own image plugin such as ppJPEG.pas.
    ReportBuilder has the ability to natively display bitmaps, jpegs, gifs, and
    metafiles.

    ---------------------------------------------------------------------
    Article: ReportBuilder Image Support
    ---------------------------------------------------------------------

    ReportBuilder natively supports .bmp, .jpeg, .wmf, .ico image formats.

    ReportBuilder has an open architecture that supports any TGraphic
    descendant.

    For example, ReportBuilder ships with a freeware component called
    GIFImage that can be used with ReportBuilder to print .gif images. (see
    the main report demo app for an example.)

    There is another freeware component called GraphicEx that
    supports several additional formats - including tiff, targa, and
    autodesk.

    It can be downloaded from:

    http://www.lischke-online.de/Graphics.html


    ReportBuilder can easily support TGraphic descendants
    with a simple register call.

    Below is the code to our ppGIF.pas unit which
    'uses' and registers the freeware GIFImage component.


    {********************************************************************}
    { }
    { ReportBuilder Report Component Library }
    { }
    { Copyright (c) 1996, 2000 Digital Metaphors Corporation }
    { }
    {********************************************************************}

    unit ppGIF;

    interface

    {$I ppIfDef.pas}

    uses
    ppCtrls, GIFImage;

    implementation

    {***************************************************************
    *
    ** I N I T I A L I Z A T I O N / F I N A L I Z A T I O N
    *
    {****************************************************************}

    initialization

    ppRegisterGraphicClass('GIF', TGIFImage);

    finalization

    ppUnRegisterGraphicClass(TGIFImage);

    end.


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2008
    Hi Nico. Thanks for the thorough explanation.

    The component is an ActiveX control called TSigPlus. It is a descendant of
    TOleControl. It stores the graphic as a BitMap, but has a lot of other
    things as well. It has a method where I can get the BitMap into an array of
    byte. I'm just not sure how to get it over to ReportBuilder without saving
    the bitmap to a file and then loading it into the database and then using
    ReportBuilder to do that. This is the method I am using right now. It
    works, but I would rather bypass two things that I have to do right now: 1)
    saving the image onto disk in the windows temp folder and then reloading it,
    and 2) saving the image into a database which already is saving the
    information for the bitmap as a string in a Memo field. In other words, I'm
    saving two different versions of the signature which wastes disk space. The
    string version of the bitmap is a nicely compressed version which contains
    additional biometric data as well as the bitmap image, while the other
    contains only the bitmap version for ReportBuilder to understand.

    I guess my question for you would be: If I have a bitmap graphic of the
    signature in memory, such as in an array of byte, is there a way for
    ReportBuilder to access it and use it?

    Thanks for your time.

    Delphi 2007, ReportBuilder Enterprise 10
  • edited January 2008
    Hi David,

    If you can stream the bitmap to a memory stream, you could easily load it
    into a TppImage on a report using the
    ppImage1.Picture.Bitmap.LoadFromStream(); routine.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2008
    Great! Yes, I successfully moved the bitmap into a memory stream today.

    What would be the best event for this? Can I do this directly in RAP?


  • edited January 2008
    Hi David,

    You can use any event that fires before the image prints. The
    Band.BeforePrint event would be a good starting place.

    In order to do this from RAP, you will need to create a passthru function to
    access the LoadFromStream routine.

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