Convert PDF to XML in C#
PowerPoint .NET API for converting PDF documents to XML files on NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms
Convert PDF to XML in C#
How do I convert PDF to XML in code?
Using Aspose.Slides for .NET , any developer or application can convert PDF to XML files with just a few lines of C# code.
As a modern document processing API, Aspose.Slides for .NET exports PDF pages to XML quickly. Aspose PowerPoint library allows you to convert PDF to XML and many other file formats.
To install Aspose.Slides: Open NuGet package manager. Search for Aspose.Slides and install it.
Or you can install Aspose.Slides by running this command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Slides.NET
How to Convert PDF to XML in C#
Developers and applications can convert PDF to XML this way:
Create an instance of the Presentation class.
Load the PDF file.
Add slides based on the PDF pages.
Save the slides to XML.
System Requirements
Before you run the PDF to XML conversion C# code, your machine must have these prerequisities:
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
- Development environment like Microsoft Visual Studio.
- Aspose.Slides for .NET DLL has been referenced in your project.
C# code to convert PDF to XML
using (Presentation pres = new Presentation())
{
pres.Slides.AddFromPdf("doc.pdf");
pres.Slides.RemoveAt(0); // removes default empty slide
for (var index = 0; index < pres.Slides.Count; index++)
{
ISlide slide = pres.Slides[index];
using (FileStream stream = new FileStream($"doc-{index}.xml", FileMode.Create, FileAccess.Write))
{
slide.WriteAsSvg(stream);
}
}
}
Free Online Converter
Other Supported Conversions
Aspose.Slides supports conversion operations for many file formats