Irvin Dominin
Irvin Dominin

Reputation: 30993

CreateMeasurementGraphics issue

On a specific web server I'm taking the default printer and using it to create a device context for printing; I'm facing the following issue using CreateMeasurementGraphics.

Using this code (VB .NET sorry :-( ):

Dim ps As PageSettings = GetPageSettings(parms)
Dim pr As PrinterSettings = GetPrinterSettings()
printerGraphics = pr.CreateMeasurementGraphics(ps)

I'm getting:

System.Reflection.TargetInvocationException: Eccezione generata dalla destinazione di una chiamata. ---> System.OutOfMemoryException: Memoria insufficiente. in System.Drawing.Graphics.FromHdcInternal(IntPtr hdc) in System.Drawing.Printing.PrinterSettings.CreateMeasurementGraphics(PageSettings pageSettings) in Sistemi.Builder.Tools.Printing.EmfDC.OnPageChanged(PrintPageParms parms)

(translated is OutOfMemory)

What I have checked:

I'm going crazy...

Upvotes: 0

Views: 267

Answers (1)

Irvin Dominin
Irvin Dominin

Reputation: 30993

Solved; it's a known issue caused by a combination of 64bit server-enable 32bit on the application pool-impersonation.

To solve the issue it must be removed the enable 32bit flag on the application pool.

Ref: https://blogs.msdn.microsoft.com/winsdk/2015/05/19/printing-successfully-using-impersonation-from-a-32-bit-application-on-a-64-bit-system/

Upvotes: 1

Related Questions