Hi All,
I have a XML file which contains employee details like
<?xml version="1.0" encoding="utf-8" ?>
Robert
1000
Robert Raj
1000
from this xml file how come i will able to generate PDF file.
To generate PDF file.
Do I need to generate another XML file which follows aspose.pdf.xsd from source xml file.
or Can I make use of directly my source xml to generate pdf.
or Do I need to generate another XML file which follows aspose.pdf.xsd using XSL.
Thanks
Robert
Dear Robert,
Thanks for your consideration.
You need to use a XSL file. Here is an example:
[Employees.xml]
<?xml version="1.0" encoding="utf-8" ?>
Robert
1000
Robert Raj
1000
[Employees.xsl]
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version=“1.0” xmlns:xsl=“XSLT Namespace”>
<xsl:output omit-xml-declaration=“yes” />
<xsl:template match=“text()” />
<xsl:template match=“/employees”>
<Pdf xmlns=‘Aspose.Pdf’ xsi:schemaLocation=‘Aspose.Pdf c:/Xml/Aspose.Pdf.xsd’
xmlns:xsi=‘http://www.w3.org/2001/XMLSchema-instance’ >
Name
salary
<xsl:for-each select=“employee”>
<xsl:value-of select=“name”/>
<xsl:value-of select=“salary”/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
[C# code]
Pdf pdf = new Pdf();
pdf.BindXML(“Y:/test/Employees.xml”,“Y:/test/Employees.xsl”);
pdf.Save(“d:/temp/Test.pdf”);
[VB code]
Dim pdf As Pdf = New Pdf()
pdf.BindXML(“Y:/test/Employees.xml”,“Y:/test/Employees.xsl”)
pdf.Save(“d:/temp/Test.pdf”)