Convert PDF file to XML file in C# - Step by Step

This is a C # example to convert PDF file to XML via a free C# PDF library. Only the .Net platform and nothing else, 32 and 64-bit support, Medium Trust level, converting of all types of PDF documents, works under Windows, Mac, Linux and a lot of other nuances.

C# (348.1 KB)
 
 
 
 
 
1.5 Star
(6)
3,786 times
Add to favorites
2/3/2016
E-mail Twitter del.icio.us Digg Facebook
using System;
using System.IO;
using SautinSoft;

namespace Sample
{
    class Sample
    {
        static void Main(string[] args)
        {
            string pathToPdf = @"d:\Download\Table.pdf";
            string pathToXml = Path.ChangeExtension(pathToPdf, ".xml");

            // Convert PDF file to XML file.
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            	    	
            f.XmlOptions.ConvertNonTabularDataToSpreadsheet = true;

            f.OpenPdf(pathToPdf);

            if (f.PageCount > 0)
            {
                int result = f.ToXml(pathToXml);
                
                //Show HTML document in browser
                if (result==0)
                {
                    System.Diagnostics.Process.Start(pathToXml);
                }
            }
        }
    }
}