Free Support Forum - aspose.com

Pdf.BindXml is failing

I am attempting to create a PDF document from an XML file. I do not need any XSL processing, but the BindXml method seems to require that I supply a path to an XSL file. I tried leaving the parameter off and just supplying an empty string, but these both failed.

Finally I created an XSL stylesheet which performs an identity transform. However when I pass this to the program, it fails and tells me:

Access to the path “C:\WINNT\system32\temp.xml” is denied.

1) Is there a way to call BindXml without requiring an XSL transform?

or

2) If XSL is absolutely required, why are you creating temp files in the system directory instead of the temp directory?

Thanks,
Tony

Dear Tony,

Thanks for your consideration.

1) Is there a way to call BindXml without requiring an XSL transform?

Absolutely yes!

All the Demos are written without using an XSL transform.

For example,

[C#]
string path = MapPath(".");
string xmlFile = path + “\Xml\AlphabeticalList.xml”;
pdf.BindXML(xmlFile, null);

[Visual Basic .Net]
Dim path As String = MapPath(".")
Dim xmlFile As String = path + "\Xml\AlphabeticalList.xml"
pdf.BindXML(xmlFile, Nothing)

2) If XSL is absolutely required, why are you creating temp files in the system directory instead of the temp directory?

Sorry Tony it’s a bug and we have fixed it. Please replace the installed Aspose.Pdf.dll with the fixed one. Thanks for your patience.


OK, I switched to pass null to BindXml. I am getting a new error now:

My code looks like:
------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
String path = Server.MapPath(“CLTest.xml”);
Pdf pdf = new Pdf();
pdf.BindXML(path, null);
pdf.Save(Response);
}
------------------------------------------------

My XML looks like:
------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<Pdf Title=“career liftoff™ Interest Inventory” Author=“J.W. Lewis > Associates, LLC”
Producer=“www.careeliftoff.com” Creator=“RCM Technologies”
Subject=“Sample Inventory” Keywords=“Pdf Career Liftoff Inventory”>


Hello World



------------------------------------------------

This generates error:
------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 24: Pdf pdf = new Pdf();
Line 25: pdf.BindXML(path, null);
Line 26: pdf.Save(Response);
Line 27: }
Line 28:


Source File: c:\inetpub\wwwroot\asposetest\default.aspx.cs Line: 26

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Aspose.Pdf.Document.DocumentBase.set_ResourceFileName(String value)
Aspose.Pdf.Xml.d7.ProcessSingleSegment(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, String content, AssignInfo assignInfo, W7 useType)
Aspose.Pdf.Xml.j7.ProcessText(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, AssignInfo assignInfo, W7 useType, Boolean isFirst)
Aspose.Pdf.Xml.b7.ProcessSection(Pdf doc, Section section, AssignInfo assignInfo)
Aspose.Pdf.Xml.H7.AssignPages(Pdf doc)
Aspose.Pdf.Xml.J7.GenerateDocument(E6 gen, Pdf doc)
Aspose.Pdf.Pdf.Save(HttpResponse response)
AsposeTest.Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\asposetest\default.aspx.cs:26
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

------------------------------------------------------------------------
How do I fix this?

Thanks,
Tony

A followup to above – I installed and built the demo files and they fail with same error on my machine. I cannot run either my simple test program or your demos with either new or original DLL.

Original DLL fails trying to create temp file in system dir.
New DLL fails with bad object reference as show in previouw message.

On the surface, your product is very impressive, but it seems very buggy. I like the documented capabilities, but we cannot use this with a client unless your product is stable. Evaluation score at this point is: D

Tony

Dear Tony,

Sorry it’s a bug and now we have fixed it.

Please download it and then replace the installed Aspose.Pdf.dll with it.

Thanks for your patience.