Hi,
I have a requirement on DOCX to PPTX conversion.
I’ve installed Aspose.Total with a temporary license & working on .NET framework. I’ve already tried converting DOCX to HTML & then to PPTX. But that had issues with tables, shapes & icons. Raised a query on that too: https://forum.aspose.com/t/conversion-of-docx-into-ppt/259578?u=niverajkumar
So trying on an alternative approach: DOCX to PDF conversion with landscape orientation. This works fine. But now when I try converting this PDF to PPTX, I get an exception as follows:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Here’s my code for your reference:
public static void PdfToPresentationConverter()
{
var license = new License();
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ConsoleApp2.Aspose.Total.NET.lic"))
{
license.SetLicense(stream);
}
Aspose.Words.Document doc = new Aspose.Words.Document("Rendering.docx");
foreach (Aspose.Words.Section sec in doc.Sections)
{
sec.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;
}
doc.Save("Rendering.pdf");
Stream pdfStream = new FileStream("Rendering.pdf", FileMode.Open, FileAccess.ReadWrite);
Presentation pres = new Presentation();
pres.Slides.AddFromPdf(pdfStream);
pres.Save("ImportedPdfPresentation.pptx", SaveFormat.Pptx);
}
And attaching the files I used: Rendering.zip (323.1 KB)
Please let me know if I’m missing something.
Here’s some information that you might need:
- OS version on which the code was executed: Windows 10
- .NET target platform in the app: Am currently trying this on .NET Framework 4.7.2 & we might want this to work on .NET Core 3.1 & higher versions too.
- Aspose.Slides and Aspose.Words versions I used: I used Aspose.Total (Aspose.Slides: 23.1.0.0 & Aspose.Words: 22.12.0.0)
Thanks,
Nivedhitha