Introduction

This is a C# example to convert PDF file to XML via a free C# PDF library.


If you are searching for a solution to convert PDF documents into XML-format in C#, stop the searching - you're in the right place! The PDF Focus .Net is only the one library designed for this purpose.


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
.

Main Functions

How to do it:

So, here we'll show you in details how to convert a PDF document to XML-DOC in C#.

Very simple example. For example, we've the PDF file: table.pdf (please see in att. file) and we need to create an XML document from table.pdf

Step 1: Launch Visual Studio 2010 (2013). Click File->New Project->Visual C# Console Application.

Type the application name and location, for example "pdf to xml" and "c:\samples".

Step 2: In the Solution Explorer right-click on "References" and select "Add Reference". Next add a reference to the "SautinSoft.PdfFocus.dll".

Step 3: So, we've created an empty C# console application. Now type the C# code to convert our table.pdf into simple table.xml

Step 4: Please insert c# code in your console application. Now build the application and launch it.

Well done! Our congratulations, with help of the PDF Focus .Net library we've created an editable Word document.

 

C#
Edit|Remove
using System; 
using System.IOusing 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(); 
             // You may download the latest version of SDK here:    
             // www.sautinsoft.com/products/pdf-focus/download.php             
            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); 
                } 
            } 
        } 
    } 
}

Source Code Files

Related Links:

Website: www.sautinsoft.com
Product Home: PDF Focus .NET
Download: PDF Focus .NET

Requrements and Technical Information

Requires only .Net 2.0 or above. Our product is compatible with all .Net languages and supports all Operating Systems where .Net Framework can be used. Note that PDF Focus .Net is entirely written in managed C#, which makes it absolutely standalone and an independent library