We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Slide Master GetThumbnail exception

Hi. I am evaluating Aspose.Slides, and in my code I am reading a given ppt file and trying to read the background image from the ppt master slide.
Here’s the error message and the code I am using: (ppt file used is also attached herewith)

(My posting is getting truncated. So I have included the text in the attached post.txt)

System.NullReferenceException was unhandled by user code
Message=“Object reference not set to an instance of an object.”
at Aspose.Slides.HeaderFooter.get_DateTimeText()
at Aspose.Slides.TextFrame.෮(HeaderFooter ෧, Int32 ෨)
at Aspose.Slides.TextFrame.෭(HeaderFooter ෧, Int32 ෨)
at Aspose.Slides.TextFrame.ટ(Image ട, Matrix ഠ, IDrawingControl ഡ, ArrayList ഢ, ArrayList ണ, HeaderFooter ෧, Int32 ෨)
at Aspose.Slides.Rectangle.ટ(Image ട, Matrix ഠ, IDrawingControl ഡ, ArrayList ഢ, ArrayList ണ, HeaderFooter ෧, Int32 ෨)
at Aspose.Slides.Shape.ટ(Image ട, Matrix ഠ, IDrawingControl ഡ, ArrayList ഢ, ArrayList ണ)
at Aspose.Slides.Slide.GetThumbnail(Size imageSize, Rectangle window, IDrawingControl drawingControl)
at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
at PPTImport.CreateNewStyle(String name, MainMaster master) in c:\VSS3\Fuse\App_Code\PPTImport.cs:line 158
at PPTImport.Import(Guid CourseID, Presentation p, Guid[] assetlist, String name) in c:\VSS3\Fuse\App_Code\PPTImport.cs:line 120
at Utilities_ImportPPTUC.ImportButton_ServerClick(Object sender, EventArgs e) in c:\VSS3\Fuse\UserControls\ImportPPTUC.ascx.cs:line 147
at System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e)
at System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Dear Aseem,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides.

I don’t think, you can get thumbnails of master slides, but I found out that older versions like Aspose.Slides, can take it successfully.

We will investigate it and restore this functionality as soon as possible, if possible.

Thanks Shakeel, But the version of Aspose.Slides that I am evaluating is: (for .Net)
As a matter of fact, it shows the GetThumbnail available for Master slides with a total of 7 overloads.
Its just that I am getting the exception that I mentioned earlier when I call master.GetThumbnail(Size System.Drawing.Size) in my code. I am attaching the ppt that I am getting the error on.
All I am trying to do is extract all the GroupShapes and Gradients embedded in the ppt as a single jpg image file so that I can use it as the background image in my ASP.Net pages. I am using C#.
Please let me know if there is a better way of doing that.

Thanks again for your help.


In that case, you can just add empty slide temporarily that follows your master and get its thumbnail image and then remove that slide. This way, you will get the image of master slide.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see the image taken by this way.

Presentation pres = new Presentation(@"d:\downloads\Test+bg.ppt");

Slide sld = pres.AddEmptySlide();

Image img = sld.GetThumbnail(1.0, 1.0);

img.Save("c:\\out.jpg", ImageFormat.Jpeg);


Please try the latest version of Aspose.Slides for .<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />NET.