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

Free Support Forum - aspose.com

Savetopdf() lossing formating

i have created one presentation with two slide which cantains one image & text box on each slide.

when i'm generating pdf with SaveToPdf() method it loosing formating like background pattern,and picture are not showing properly

Presentation pres = new Presentation();




Dear Alpesh,

Please attach your source presentation and your code should look like this.

Presentation pres = new Presentation("source.ppt");//source.ppt is source presentation


To attach file, you can click on Reply button and then Add Attachment button.

Note: Do not confuse Reply button at the top with Quick Reply button at the bottom.

Hi. I am experiencing an issue similar to Alpesh but I think I can provide more detail.

I’m evaluating Aspose.Slides for .Net and using version

We use EMF images of charts in our presentations. We have found that using a vector format such as this is absolutely essential to having high quality images for printing while retaining reasonable file sizes.

The PowerPoints we create using Aspose show the EMF format fine and look great. However, when we call Presentation.SaveToPdf(System.IO.Stream), it appears that the EMF format images are being converted into very low quality images before they are added to the PDF. This is not a limitation of PDF, because if we manually use Acrobat to convert the same PowerPoint to PDF, the images are embedded as EMF format.

What is important to us is using some sort of vector format image, not EMF specifically, so I tried SVG. This led to the exception:

Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Aspose.Slides.PPImage…ctor(Presentation parent, Stream stream, Boolean close_stream)
at Aspose.Slides.Picture…ctor(Presentation parent, Stream stream)
at WorkplaceDynamics.Results.Presenting.Summaries.insertFactorStatementsHeatMap(User user, Int32 surveyEventId, Factor factor, Shape shape) in C:\VersionControl\Applications\Results\Trunk\WorkplaceDynamics.Results.Presenting\Summaries.cs:line 150
at WorkplaceDynamics.Results.Presenting.Summaries.customizeSlide(User user, Int32 surveyEventId, Slide slide, Factor topFactor, Factor bottomFactor) in C:\VersionControl\Applications\Results\Trunk\WorkplaceDynamics.Results.Presenting\Summaries.cs:line 62
at WorkplaceDynamics.Results.Presenting.Summaries.customizePresentation(User user, Int32 surveyEventId, Presentation presentation) in C:\VersionControl\Applications\Results\Trunk\WorkplaceDynamics.Results.Presenting\Summaries.cs:line 44
at WorkplaceDynamics.Results.Presenting.Summaries.WriteSummaryToStream(Stream stream, User user, Int32 surveyEventId, String templateDirectory, Boolean isPdf) in C:\VersionControl\Applications\Results\Trunk\WorkplaceDynamics.Results.Presenting\Summaries.cs:line 23
at WorkplaceDynamics.Results.UI.Summary.ProcessRequest(HttpContext context) in C:\VersionControl\Applications\Results\Trunk\WorkplaceDynamics.Results.UI\Summary.ashx.cs:line 32
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Getting the exception isn’t surprising, as Microsoft products typically have better support for EMF than for SVG, but the stack trace suggests one possible explanation for the EMF issue. System.Drawing.Image does not natively support saving EMF files.

The Microsoft documentation (https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image.save?redirectedfrom=MSDN&view=windowsdesktop-5.0#System_Drawing_Image_Save_System_String_) indicates:
If no encoder exists for the file format of the image, the Portable Network Graphics (PNG) encoder is used. When you use the Save
method to save a graphic image as a Windows Metafile Format (WMF) or
Enhanced Metafile Format (EMF) file, the resulting file is saved as a
Portable Network Graphics (PNG) file. This behavior occurs because the
GDI+ component of the .NET Framework does not have an encoder that you
can use to save files as .wmf or .emf files.
This sounds a lot like what is happening when the PowerPoint is saved to PDF using SaveToPdf()

So with all that said, is there any way that I can use Aspose to save a dynamically created PowerPoint that contains EMF images to a PDF that retains the high quality of the EMF images?

Not being able to do this makes the output so unprofessional looking that we will not be able to use the product.

We would be willing to buy both Aspose.Slides and Aspose.PDF if that’s what it took, but I don’t see any mention of the PowerPoint format in the Aspose.PDF marketing pages on the web site.

Thank you very much for your help!