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

Error "Canvas does not allow drawing" printing to PDF with EmbedFontOption

edited August 2013 in General
Hi,

the error "Canvas does not allow drawing" occurs printing to PDF only
with EmbedFontOption and (so it seems) producing larger files with more
than 500 pages.

Here is a small snippet of code:

procedure ExportToPDF(const aFilename: string);
begin
ppReport1.AllowPrintToFile := True;
ppReport1.ShowPrintDialog := False;
ppReport1.ShowCancelDialog := False;
ppReport1.DeviceType := dtPDF;
ppReport1.TextFileName := aFilename;
ppReport1.PDFSettings.EmbedFontOptions := [efAllFonts];
ppReport1.Print;
end;

Method ppReport1.Print fires the exception. After this an operating
system error is displayed with the message

"Access violation at address 77048E19 in module 'ntdll.dll'. Write of
address 00000014."

and sometimes follows the error message

"Runtime error 216 at 0040918A".

Without the EmbedFontOptions assignment the reportbuilder works fine!

This behaviour is reproduceable on several operating systems e.g.
Windows Server 2008 R2 and Windows 7 Professional.
What can I do?

Best regards

Michael

--
ReportBuilder Enterprise Edition Version 15.0 Build 201
Delphi XE4 Professional

Comments

  • edited August 2013
    Hi Michael,

    Does this happen with every report you export with EmbedFontOptions set
    to AllFonts? Is there a certain font causing the issue? Which fonts
    are you using inside your report.

    When embedding all fonts, your file size will increase due to the fact
    that you are embedding the entire font file inside the resulting PDF file.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2013
    Hi Nico,

    yes, this happens with every report exporting PDF with EmbedFontOptions.
    I've reduced the resultset of the database query of a little test
    report. So I got a correct PDF file with a few pages. Here are the used
    fonts:

    Arial (Embedded)
    Type: TrueType
    Coding: Ansi

    Arial,Bold (Embedded)
    Type: TrueType
    Coding: Ansi

    Arial,Italic (Embedded)
    Type: TrueType
    Coding: Ansi

    The original resultset causes more pages, and the mentioned error occurs.

    Yes I know, embedding fonts will increase the file size. Here are some
    statistics about recordcount, pagecount and filesize (pdf file of my
    test report with embedded fonts):

    Records Pages Filesize [Bytes]
    1000 18 1287932
    2000 36 1405363
    3000 53 1522339
    4000 71 1639591
    5000 ...Exception...

    Any ideas?
    Thanks in advance.

    Michael




    Am 28.08.2013 18:31, schrieb Nico Cizik (Digital Metaphors):
  • edited August 2013
    Hi Michael,

    Based on your description this sounds like a memory or resource leak of
    some kind (either inside your application or ReportBuilder).

    Try running your application with a memory manager such as FastMM and
    see if a leak is present. If not, try to create a simple example I can
    run here and send it to support@digital-metaphors.com in .zip format.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.