Convert PPTX to XPS

Could you please send me code to convert PPTX file to XPS.

I am getting “Unsupported brush type” error.

Dim fname As String = Request.QueryString("fileName").ToString()
Dim fPath As String = Request.QueryString("filePath").ToString()

Dim pptMemoryStream As New MemoryStream(AccessHelper.GetFile(fPath + fname, False).PublishedVersion.File)

'Create a presentation object using Aspose
Dim pres As New PresentationEx(pptMemoryStream)

'Instantiate the TiffOptions class
Dim opts As Aspose.Slides.Export.XpsOptions = New Aspose.Slides.Export.XpsOptions()

'Set MetaFile as PNG
opts.SaveMetafilesAsPng = True

Dim path As String = Server.MapPath("./XPS/") + fname

'Saving the presentation to TIFF document
pres.Save(path, Aspose.Slides.Export.SaveFormat.Xps, opts)

Thank you,
Vamshi Krishna


This message was posted using Email2Forum by salman.sarfraz.

Dear Vamshi,

I have used the following modified code for generating the XPS from PPTX using Aspose.Slides for .NET 4.2.0, which is available here. Can you please use the following code with the latest release and hopefully things will work for you.

Dim fIS As FileStream = New FileStream("D:\\ppt\\Test.pptx", FileMode.Open, FileAccess.Read)

Dim pptMemoryStream As New MemoryStream()

Dim fileBytes As Byte() = New Byte(fIS.Length) {}

fIS.Read(fileBytes, 0, fileBytes.Length)

pptMemoryStream.Write(fileBytes, 0, fileBytes.Length)

pptMemoryStream.Position = 0

'Create a presentation object using Aspose

Dim pres As New PresentationEx(pptMemoryStream)

'Instantiate the TiffOptions class

Dim opts As Aspose.Slides.Export.XpsOptions = New Aspose.Slides.Export.XpsOptions()

'Set MetaFile as PNG

opts.SaveMetafilesAsPng = True

'Saving the presentation to TIFF document

pres.Save("D:\\ppt\Test.xps", Aspose.Slides.Export.SaveFormat.Xps, opts)

Thanks and Regards,