I am getting this error when I call the GdViewer.PrintShowPrinterSettingsDialog method.
An unexpected error has ocurred.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at GdPicture12.Internal.Printing.GdPicturePrinting.ᜀ.gdpicture_ᜀ(IntPtr A_0, IntPtr A_1, String A_2, IntPtr A_3, IntPtr& A_4, Int32 A_5)
at GdPicture12.Internal.Printing.GdPicturePrinting.ᜀ.ᜀ(IntPtr A_0, String A_1)
at GdPicture12.Internal.Printing.GdPicturePrinting.gdpicture_ᜀ(IntPtr A_0)
at PdfViewerNS.PrintWindow.btnPropriedades_Click(Object sender, EventArgs e)
I have a GdViewer showing a PDF file that I want to print.
This error occurs only in some machines, mainly Windows 8 and Windows 10, but not all, and I don't know the reason.
My code is similar to example
This is the method to select the printer:
private void cbxPrinters_SelectedIndexChanged(object sender, EventArgs e)
bool ok = gdPicturePrinter.viewer.PrintSetActivePrinter(cbxPrinters.Text);
This is the method to show printer settings:
private void btnPropriedades_Click(object sender, EventArgs e)
var res = gdPicturePrinter.viewer.PrintShowPrinterSettingsDialog(this.Handle);
if (res != GdPictureStatus.OK)
Can someone help me?
I solved my problem changing the method call from gdPicturePrinter.viewer.PrintShowPrinterSettingsDialog(this.Handle) to gdPicturePrinter.viewer.PrintShowPrinterSettingsDialog()
I don't know why, but this worked for me.
Who is online
Users browsing this forum: No registered users and 2 guests