Pdf from xml/xslt

we've been getting this error trying to set the aspose.pdf.lic file:

dim licensepdf as new license
licensepdf.setlicense("aspose.pdf.lic")

xmlexception: this is an unexpected token. the expected token is 'tagend'

we have been unable to find a workable solution in the forums or knowledgebase. we don't find 'tagend' anywhere in any xml file.

your help would be greatly appreciated. thanks!


This message was posted using Aspose.Live 2 Forum

Hi,

Can you please provide us with your license file so that we can test it.

Thanks.

Hi,

It seems the license file is broken. Please check it or send it to us by following the steps mentioned in this article.

How to Send License File to Support Team

I tested your license but no error is found. Can you please check if the same license file is used in your application?

Yes, that is definitely the file we are using.

Hi,

Can you please send us your complete solution so that we can test it. Please refer to: How to Share a Document in a Forum Post

Thanks.

Hi,

There is no problem with the license file. The WorkOrder.xslt that you are using will transform the xml into html where as the BindXML method expects an xml as input which is according to the Aspose.Pdf schema. You have two options. You can use your WordOrderPDF.xslt along with the BindFO method as follows.

Aspose.Pdf.Pdf pdf1 = new Pdf();

pdf1.BindFO("AA00000_Bronze.xml", "WorkOrderPDF.xslt");

pdf1.IsTruetypeFontMapCached = true;

pdf1.TruetypeFontMapPath = System.IO.Path.GetTempPath();

pdf1.Save(@"Output.pdf");

You can also use the WorkOrder.xslt to trsnform your xml to html and then use BindHTML method to convert to PDF as follows.

// Create the XslTransform.

System.Xml.Xsl.XslTransform xslt = new System.Xml.Xsl.XslTransform();

// Load the stylesheet.

xslt.Load("WorkOrder.xslt");

// Load the XML data file.

System.Xml.XPath.XPathDocument doc = new

System.Xml.XPath.XPathDocument("AA00000_Bronze.xml");

// Create the XmlTextWriter to output to the console.

MemoryStream ms = new MemoryStream();

//System.IO.TextWriter tw = new System.IO.TextWriter();

System.Xml.XmlTextWriter writer = new

System.Xml.XmlTextWriter(ms, new System.Text.UTF8Encoding());

// Transform the file.

xslt.Transform(doc, null, writer);

ms.Seek(0, SeekOrigin.Begin);

Aspose.Pdf.Pdf pdf1 = new Pdf();

pdf1.BindHTML(ms);

pdf1.IsTruetypeFontMapCached = true;

pdf1.TruetypeFontMapPath = System.IO.Path.GetTempPath();

pdf1.Save(@"Output.pdf");

writer.Close();

Or you can write a new xslt that transform your xml into Aspose.Pdf xml and then use the BindXML method as you are doing now.

Thanks.