WPCubed Product Support

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

support

No, this is the .NET framework speciality.

This post was actually about wPDFControl.

#7 ♥ 0
11k Views 3 users read 2 min

Julian,

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

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

diamond

#6 ♥ 0

Julian,

That corrected the problem.

Thank you very much for your help.

#5 ♥ 0
support

I will investigate that shortly.

Please open the C# wrapper class1.cs and locate

public void CloseCanvas()

Please insert after DrawMetafile() the line:

wWindowsWrap.DeleteEnhMetaFile(MetaReference);

I assume this is it.

Julian

#4 ♥ 0

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 :|

#3 ♥ 0
support

Hi,

I seems so that the internal canvas was not freed.

Did you try to insert a garbage collection run call within that loop.

Julian

#2 ♥ 0

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:

PDFControl pdf = new PDFControl();

            pdf.SetLicense("XXX", "XXX", 888);
            pdf.FontMode = eFontMode.EmbedTTF;
            pdf.BeginDoc(Application.StartupPath + "\\TestPdf.pdf");

            for (int i = 0; i < 5000; i++)
            {
                pdf.StartPage();
                pdf.EndPage();
            }
            pdf.EndDoc();

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!

#1 ♥ 0