Print PPTX gets System.MethodAccessException (.net4)

Print attached pptx document using:

var doc = new PresentationEx(docPath);
doc.Print(printer);

gets following exception

System.MethodAccessException :

Attempt by security transparent method ‘.‘.(System.Drawing.Bitmap)’ to access security critical method ‘System.Runtime.InteropServices.Marshal.Copy(IntPtr, Byte[], Int32, Int32)’ failed.

Assembly ‘Aspose.Slides, Version=5.6.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
at .‘.(Bitmap bitmap)
at Aspose.Slides.Effects.ImageTransformOperationEx.(Bitmap img, pixEff)
at Aspose.Slides.Effects.Luminance.(Bitmap img, BaseSlideEx slide, FloatColor styleColor)
at Aspose.Slides.Effects.ImageTransformEx.(BaseSlideEx slide, FloatColor styleColor, Bitmap img)
at Aspose.Slides.Pptx.PictureEx.(BaseSlideEx slide, FloatColor styleColor, Boolean ownCopy)
at .‹.(ShapeFrameEx shapeFrame, GraphicsPath grPath, BaseSlideEx slide, FloatColor& styleColor, Object& rotatedBounds, IFillParamSource fillprop)
at .‹.(ShapeFrameEx shapeFrame, GraphicsPath grPath, BaseSlideEx slide, FloatColor& styleColor, Object& rotatedBounds, IFillParamSource fillprop)
at .‹.(ShapeFrameEx frame, GraphicsPath grPath, BaseSlideEx slide, IFillParamSource[] fillprops)
at .‹…ctor(ShapeFrameEx frame, GraphicsPath grPath, BaseSlideEx slide, IFillParamSource[] fillprops)
at Aspose.Slides.Pptx.SlideEx.( canvas)
at Aspose.Slides.Pptx.SlideEx.GetThumbnail(Size imageSize)
at Aspose.Slides.Pptx.SlideEx.GetThumbnail(Single scaleX, Single scaleY)
at Aspose.Slides.Export.PresentationPrintDocument.OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Aspose.Slides.Pptx.PresentationEx.Print(PrinterSettings printerSettings, String presName)
at Aspose.Slides.Pptx.PresentationEx.Print(PrinterSettings printerSettings)
at Aspose.Slides.Pptx.PresentationEx.Print(String printerName)


Hi Yuan,

I have worked with the presentation shared and have observed a different exception while using Aspose.Slides for .NET 4 Client Profile 5.6.0.

at System.Drawing.Printing.StandardPrintController.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()

However, with Aspose.Slides for .NET 5.5.0, I have been able to print document on my default XPS printer in Windows 7 x64. An issue with ID 31891 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue is resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as 31891) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.