My viewer app was crashing spontaneously and erratically, and I reduced the problem to the following:
Create a new MFC project in Visual Studio 2003, SDI interface, FormView. On the form, put the PDF control. Add the PDF control as a variable to the form named PDF. Then, in the double-click event of the form (or a button, or whatever), do the following code:
PDF.SetLicenseKey(
"Your license", "your key"
);
int i;
PDF.InitBlank();
for(i = 0; i < 200; i++)
PDF.AddPage(0);
PDF.Save("Long.pdf", 0);
PDF.InitBlank();
for(i = 0; i < 50; i++)
PDF.AddPage(0);
PDF.Save("Short.pdf", 0);
PDF.InitBlank();
PDF.Open("Long.pdf", "");
PDF.put_CurrentPage(PDF.get_PageCount());
PDF.Open("Short.pdf", "");
for(int i = 0; i < PDF.get_PageCount(); i++)
PDF.put_CurrentPage(PDF.get_PageCount()-i);
It creates and saves a long pdf (200 pages), then a short pdf (50 pages). It re-initializes a blank PDF, then loads the long PDF, navigates to the last page, opens the short PDF, and navigates to each page starting at the end and moving toward the beginning. Partway through the last loop, the application crashes in a malloc() call from the PDF viewer.
This was happening whenever I'd open a long PDF, navigate to the end, open a shorter PDF, and navigate through its pages. I made this code to see if it was reproducible with empty PDF's of appropriate length.
I've posted the ActiveX DLL that I'm using at http://www.beandogsoft.com/downloads/pdfcreactivex.dll for your reference.
I'm using Visual Studio 2003, so the memory library is msvcr71d.dll.
I'd appreciate any feedback on this problem.