Can not create 5000 pages using StartPage()/EndPage()
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
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
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 :|
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
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!