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

Canvas / image does not allow drawing

edited August 2012 in General
Hi,
I have created some new reports and test them on my PC, everything OK.
After this, I installed them on a terminal server. Over an internet
application (Webterminal) (!!!!LOCAL Computer!!!!) the reports are call
up. If I press the button on the local machine to create the report, a
error application is popping up. Error message: "Canvas / image does not
allow drawing".
On of my colleague got the same error and he could not reproduce the
error, too.
Is the problem in the PDF export or on the terminal server?

...
David

Comments

  • edited August 2012

    The exception 'Canvas does not allow drawing' is a Delphi exception that is
    raised when an application cannot get a valid handle to a Canvas associated
    with a bitmap, screen, or printer.

    If you are generating PDF's you might check whether the machine has a
    default printer installed. If it does not, try installing one. Another thing
    you could try is setting Report.PrinterSetup.PrinterName to 'Screen'.

    ReportBuilder uses the printer device context (i.e. canvas) to measure text,
    wrap text etc. If a machine does not have a printer driver installed, RB
    should be automatically defaulting to 'Screen'.

    We don't have experience with Windows Terminal Services here, but we have
    customers using it successfully. In theory the apps should just work, but in
    reality I think there are many difference versions of Terminal Services and
    different ways to configure it.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2012
    Hello David,

    PDF export of reports with lots of text elements leaks GDI resources. In the unit ppPDFRendererCustomText method TppPDFRendererCustomText.RenderToPDF add a lBitmap.Free to the end and checkout if the problem is gone. You can check the GDIObjects in the Taskmanager (before and after the patch ;-) ).
    Terminalservers - especially older ones - do have less resources than local machines. So you will sooner run into any kind of resource problems.

    Regards,
    Michael

    Am 29.08.2012 09:51, schrieb David Wolf:
  • edited August 2012
    Hi Nard,
    after hours of testing I got the same error on my computer, too.
    But I don't understand why it works via Delphi but not about the
    Webapplication. (both on the same computer).

    I've set the propertie PrinterName to Screen but the error is still
    there. A default printer has already installed, too.
    Can the error may be raise up because of a component?
    I use this components:
    Header:
    Label
    Line
    DbText
    Variable
    Group:
    Header:
    Footer:
    Subreport2
    Title:
    Group:
    Header:
    Footer:
    Region1
    Label
    Line
    DBText
    Variable
    Detail:
    Summary:
    Detail:
    Line
    DBText
    Variable
    Footer:
    Image
    Label
    Systemvariable
    Label

    I don't have any more ideas and the customer is waiting ...
    Are there any more things I could try?
  • edited August 2012
    Hi Michael,
    i can't find the line where the bitmap is created?


    @{@TppPDFRendererCustomText.RenderToPDF }

    procedure TppPDFRendererCustomText.RenderToPDF;
    var
    lbTrueType: Boolean;
    begin

    inherited;

    FFont := DrawTextCommand.Font;
    FTextMetric := TppPDFUtils.PopulateTextMetric(FFont, Printer.Canvas);

    {Check if font is TrueType}
    lbTrueType := (FTextMetric.tmPitchAndFamily and TMPF_TRUETYPE) =
    TMPF_TRUETYPE;
    FFontName := TppPDFUtils.ProcessFontName(FFont, lbTrueType);

    StartText;

    end;
  • edited August 2012
    There is a patch available for RB 14.06 that fixes the memory leak in
    TppPDFRendereCustomText. Registered customers can email support@ and request
    the patch.

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

    Best regards,

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