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

Windows service and 'canvas does not allow drawing' error

edited April 2012 in General
Hello,
I have a windows service which produces PDF files using report
builder 14.04. One of our clients had an error today 'canvas does not
allow drawing'.

reading back through some very old posts I came up with a couple of
bits of advice.


1.) There needs to be a default printer installed. RB requires this
despite not actually printing to the printer concerned. In this case
there was a default printer but it was a network printer which was
unreachable. I installed a random print driver on lpt1 and the error
went away.

2.) set the printer name to 'Screen'. This would be the preferred
solution but did not work in this case. Would the windows service need
to be given permission to interact with the desktop for this to work?

Is there anything else I am unaware of when it comes to resolving this
error. Ideally I would like to not have to create a dummy printer on
every server I work with. In some cases this may not be possible anyway.


Regards,
Will.

Comments

  • edited April 2012
    Hi Will,

    Thanks for the info.

    We are constantly working to remove the need of a printer to export to
    file. I would be interested in knowing which report component being
    exported to PDF and/or which code is causing this error.

    When the printer is set to Screen, ReportBuilder tries to access the
    device context of the entire screen. If this is unavailable terminal
    machine, problems may arise.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2012

    If the error occurs only after the application has been running for a while,
    then it is likely caused by memory/resource leaks. 'Canvas does not allow
    drawing'. You can use FastMM in debug mode to check for leaks.

    If the above does not apply, then try to determine whether the error occurs
    with any report or just specific reports. For example, create a simple test
    report with a single label and try that, etc.

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2012
    Nico Cizik (Digital Metaphors) wrote:


    Nico,
    Because the error happens on a client machine I can't get a debugger
    to it. If you could suggest a way I might reproduce the error on a dev
    machine then I would be willing to give it a shot.
    In terms of the components on the report concerned there are

    Main Report :
    DBBarcode (bcCode39)
    DBText
    Label
    SystemVariable
    Line
    Image
    Memo

    SubReport 1
    DBText
    Label

    SubReport 2
    Memo
    DBText
    DBMemo




    The error came up again yesterday despite the default printer being
    installed. What would happen if there were more than one PDF being
    produced at a time. Whether that be in a seperate thread in the windows
    service or as another windows service application?

    Regards,
    Will.
  • edited April 2012
    Nard Moseley (Digital Metaphors) wrote:


    I will enable FastMM on this server for a couple of days to find out. I
    have seen the error immediately after a restart though.



    This could be tricky given the nature of the application, but I will
    try.

    regards,
    Will.
  • edited April 2012
    Nico Cizik (Digital Metaphors) wrote:


    I can provide you with the report template if that would help, however
    I can't supply the database behind it.

    regards,
    Will.
  • edited April 2012
    If you remove the barcode, do you still get the error? To recreate the
    error, you would likely have to run the application in a terminal
    service like your customer. The likely culprit is a loss of or
    inability to access proper resources.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2012
    Nico Cizik (Digital Metaphors) wrote:


    Nico,
    If I remove the barcode the error stops. If I put it back it starts
    up again. This issue is causing huge problems as I need the barcode
    component on the form. Looking at the code for the barcode component it
    seems that it is tied to the printer driver no matter what settings are
    used. I have made sure there is a default printer on the machine but
    that has no effect on this problem.
    Do you have any idea when the tie to the printer could be removed for
    the barcode component? If this is likely to take some time could you
    recommend a workaround please.

    Regards,
    Will.
  • edited May 2012
    Will Honor wrote:


    fastMM has been running for quite a while now and I have cleared one
    small memory leak but it has had no effect on this issue. Memory usage
    is now stable at 50MB and the application runs without any other
    problems.


    This is linked to the barcode component. Take it off the form and there
    is no problem. Put it back on and the issue arises again.


    regards,
    Will.
  • edited May 2012
    Will Honor wrote:


    I have just seen the release notes for 14.05 and it seems you have
    worked on the barcode component. I will give it a try and get back to
    you.

    Regards,
    Will.
  • edited May 2012
    Will Honor wrote:




    So far so good. Been running for a couple of hours without error.
    Thanks.



    Regards,
    Will.
This discussion has been closed.