Can not create 5000 pages using StartPage()/EndPage()

  • I am using wPDF version 2.7 and need to be able to create large pdf files. However, I am experiencing all kinds of GDI+ corruption once I hit about 4930+ pages. After the exception, all other GDI rendering is flawed and the program eventually crashes. I put the code I was using in a standalone form app and was able to reproduce. I even removed any painting to the canvas. Here is the very simple code to reproduce:

    The license is blanked out in this sample only. Has anyone seen this issue before? Am I missing something? This is a show stopper for me.
    Thanks!

  • Thank you for your response Julian,

    Yes. It looks like the canvas and the wrappers' metafile are properly being flushed and disposed. The issue may have something to do the the wrappers internal metafile instance getting corrupted. But still, totally unrelated GDI+ operations end in fatal errors. I was hoping this was a known issue with a fix. Have you been able to duplicated it? Could this be a Microsoft issue?

    Thx,
    Jerry :|

  • Julian,

    Should a similar change be made to WPPDFR1.Pas, in the CloseCanvas procedure:

    Code
    DrawMetafileEX(0, 0, 0, 0, FMetafile.Handle, DrawCanvasMetaXRes, DrawCanvasMetaYRes);
    DeleteEnhMetaFile( FMetafile.Handle ); // <--- added line


    diamond