Problem after updating to wPDF3

  • Hello,

    We have an application that uses wPDF and WPtools. When we have wPDF v2 this application worked perfectly but since updating to wPDF V3 (January 2007 build) we are getting errors, we get either an "Not enough storage to is available to process this command" in WPCTRMemo Line 8330

    Code
    if not Transparent and not FDidTriggerPaintEvent then DoPaint;

    or a "Canvas does not allow drawing" error that happens in WPPDFR1 line 959

    Code
    FCanvas := TMetafileCanvas.Create(Self, dc);

    Here is the code used to make the pdfs

    Any ideas.

    Bern
    WPTools 5.22
    wPDF dll version 3.0.6.5 Dated 1/25/2007
    BDS 2006

    • Offizieller Beitrag

    Hi,

    In unit WPPDFR1.pas you will find this source:

    implementation
    const
    {$IFDEF WPDF3}
    {$DEFINE DEF_ENHMETAFILE}
    Please change this to

    implementation
    const
    {$IFDEF WPDF3}
    {---$DEFINE DEF_ENHMETAFILE}

    This way the "old" way to create a temporary metafile is used. That is the only relevant difference I can image which can cause a problem.

    I tried wPDF on a multi CPU system for threadsavety and never had such a resource leak. I wonder what it is. Maybe removed the Application.ProcessMessage for a test.

    Julian

  • Bern,

    Julian's suggestion to rem out the Application. ProcessesMessages is an excellent one.

    While the method can be quite useful, I've found time and time again it is an application killer, forcing statements to be executed out of synch, fetching commands from the Windows queue before they should be processed.

    Looking at your code, it *appears* ProcessMessages shouldn't be executed, since it's is in the exception handler, but stranger things have happened under the sun - and it certainly might explain what you're experiencing.

    Unless you've single-stepped through, and know the exception handler is never executed, maybe throw in a MessageDlg statement in the handler to see if that gets triggered.

    Best of luck..:)
    richard diamond