Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Like to know how to convert xml file to Pdf File using C#. I tried to work it on with Aspose.pdf but when i used that dll and tried call a class PDF it show an error.
Is there any other links or information about this how to convert an xml data to Pdf file in C#

thank You
Posted

1 solution

Now Here is Example to convert Table created Using XML into PDF:
================================================================

XML :
======
<?XML version=1.0 encoding="utf-8"?>
<column>Products</column>
 <column>Units</column>
 <column>Price</column>
<row></row></
 <column>Product 1</column>
 <column>2</column>
 <column>60</column>
<row></row>
 <column>Product 2</column>
 <column>3</column>
 <column>50</column>
<row></row>
 <column>Product 3</column>
 <column>4</column>
 <column>80</column>
<row></row>
 <column>Total</column>
 <column>9</column>
 <column>190</column>


Now Equivalent PDF in c# :
==========================

C#
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDFExtractor;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create Bytescout.PDFExtractor.XMLExtractor instance
            XMLExtractor extractor = new XMLExtractor();
            extractor.RegistrationName = "demo";
            extractor.RegistrationKey = "demo";

            // Load sample PDF document
            extractor.LoadDocumentFromFile("sample3.pdf");

            extractor.SaveXMLToFile("output.XML");

            Console.WriteLine();
            Console.WriteLine("Data has been extracted to 'output.XML' file.");
            Console.WriteLine();
            Console.WriteLine("Press any key to continue and open XML in default XML viewer)...");
            Console.ReadKey();

            Process.Start("output.XML");
        }
    }
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900