AccessViolationException:attempt to read/write protected mem

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.

AccessViolationException:attempt to read/write protected mem

Postby cliffeh on Wed May 04 2011


We have a .NET application that uses Amyuni PDF Converter 4.5. For the most part it's working great for us. However, we have a user who, when he prints drawings to a large paper size, gets an AccessViolationException: Attempted to read or write protected memory. Here are some more details:
- The user's machine is Win7, x64 and we're using version of the Amyuni PDF Converter
- I'm able to print the same PDFs on my machine, which is also Win7, x64.
- An example of a PDF that causes the exception is about 1.5MB. He's able to print drawings on smaller paper sizes, though.
- We've tried reinstalling the Amyuni driver numerous times. We've also tried creating a new, administrative user profile for the user, in case his user profile was corrupt.

I'm not sure what other information to give. Here's a sampling of the code:
\$matches[0]: \$matches[0]
                    //init driver
                    hPrinter = DriverInit(PDFPRINTER);

                    //set lots of options here: paper size, orientation, resolution, filename...

                    EnablePrinter(hPrinter, PDFLICENSEE, PDFACTIVATIONCODE);

                    //Printing Magic
                    LocalPrintServer ps = new LocalPrintServer();
                    PrintQueue pq = ps.DefaultPrintQueue;

                    pq.UserPrintTicket = pt;
                    xpsW = PrintQueue.CreateXpsDocumentWriter(pq);

                    xpsW.WritingCompleted += new System.Windows.Documents.Serialization.WritingCompletedEventHandler(xpsW_WritingCompleted);

                    if(hPrinter != IntPtr.Zero)  //PDF Print in Progress, so activate as close as possible to the actual print
                      EnablePrinter(hPrinter, PDFLICENSEE, PDFACTIVATIONCODE);

                    // visPrint is a WPF Visual

Any thoughts would be much appreciated.

Cliffe Hodgkinson
Posts: 5
Joined: Tue Mar 23 2010

Re: AccessViolationException:attempt to read/write protected mem

Postby Devteam on Fri May 06 2011

This issue might be font related. We have fixed an issue with specific fonts crashing the printer driver. We suggest that you use the latest which is free for all users of
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at -
Posts: 109
Joined: Fri Oct 14 2005
Location: Montreal

Return to Amyuni PDF Converter (PDF Printer Driver)

Who is online

Users browsing this forum: No registered users and 1 guest