Free Support Forum - aspose.com

BindFO() throwing XSL COmpile error

Hi.. We upgraded the PDF toolkit from 3.6 to 7.4 and having this issue

Hi Srinivasa,


Thanks for contacting support.

Can you please share the code snippet and resource files which you are using, so that we can test the scenario at our end. We are really sorry for this inconvenience.

Hi, I could fix this issue but the Formatted Text alignment goes wrong... not retaining \n \t character formatting.

XML for ex:
<?xml version=\"1.0\" standalone=\"no\"?>\n\n\t\n\t\t1\n\t\t<Text type=\"String\">\n TEST REPORT Page 1\n \n CUSTOMER: Regression Print File\n \n DATE: 6 16, 2009\n \n \n CHECK NO. INVOICE NO. REMITTER AMOUNT\n---------------------------------------------------------------------------------------------\n 833272 H70240 TESTER DANIELS COMPANY 20,261.12\n H71270\n H71279\n\t\n\t\t

*** H71270\n H71279 are supposed to align with H70240 and been working fine with PDF version 3.6.0.0, but not with version 7.4.0.0

XSL FO parsing this text is ..


<fo:block font-family="monospace" white-space-collapse="false" wrap-option="no-wrap"
linefeed-treatment="preserve"
white-space-treatment="preserve">






Thanks
Srini

Hi Srinivasa,


Thanks for sharing the resource files.

I have tried testing the scenario but I am afraid I am getting an error message. “Data at the root level is invalid. Line 1, position 1.”. It seems to be an issue with the input files. I have tried using the same code snippet which you have shared.

[C#]

Pdf pdf = new Pdf();<o:p></o:p>

string strPath = "ReportFileList_SRM_pdf.xsl";

var xmlDocument = new System.Xml.XmlDocument();

xmlDocument.LoadXml("d:/pdftest/SRM-XML.Xml");

var xslDocument = new System.Xml.XmlDocument();

xslDocument.Load(strPath);

pdf.BindFO(xmlDocument, xslDocument);

pdf.IsTruetypeFontMapCached = true;

pdf.TruetypeFontMapPath = "d:/pdftest/";

pdf.Save("d:/pdftest/BindXML_Issue.pdf");

Hi, I am no longer getting XSL compile error and able to download with XML data and XSL provided.. I got the LineFeed formatting being preserved but \t tabspace is not being preserved with newer 7.4.0.0 DLL.

Can you confirm whether formatted text '\t' works? I can confirm '\n' is working fine.

Thanks
Srini

I emailed the code snippet, XML data and XSL files last evening in Zip format to Codewarrior. Please find it or else would email again.

SriniD100:
I emailed the code snippet, XML data and XSL files last evening in Zip format to Codewarrior. Please find it or else would email again.
Hi Srinivasa,

Thanks for your patience.

I have used the same resource files which you have shared to test the scenario and have been getting the error message as I have stated in 426602. Can you please again test the resource files and the code snippet at your end. We are sorry for this inconvenience.

[C#]

Aspose.Pdf.Generator.Pdf pdf = new
Aspose.Pdf.Generator.Pdf();<o:p></o:p>

string strPath = @"D:\pdftest\New Folder\";

StringBuilder strNewPathXsl = new StringBuilder();

strNewPathXsl.Append(strPath);

if (!strNewPathXsl.ToString().EndsWith("\\"))

{

strNewPathXsl.Append('\\');

}

strNewPathXsl.Append("ReportFileList_SRM_pdf.xsl");

var xmlDocument = new System.Xml.XmlDocument();

xmlDocument.LoadXml( @"D:\pdftest\New Folder\SRM-XML.Xml");

var xslDocument = new System.Xml.XmlDocument();

xslDocument.Load(strNewPathXsl.ToString());

pdf.BindFO(xmlDocument, xslDocument);

pdf.IsTruetypeFontMapCached = true;

pdf.Save(@"D:\pdftest\New Folder\PDFFILE.pdf");

Do you have anumber I can dial?

Hi Srinivasa,


I am afraid we do not provide technical support over phone/call and we encourage Forum/Live chat support. Can you please share the complete project with all required resources so that we can test the scenario at our end. We are really sorry for this inconvenience.

Hi Nayyar,
I emailed a zipped file containing the XSL, XML, C# as well as AsposeTrueFontMap.XML files on last friday. I have tried same with version 7.4 and 7.5, the output works fine except retaining Tabspace.

Expected Format of the output is

CUSTOMER: Regression Print File
DATE: 6 16, 2009


CHECK NO. INVOICE NO. REMITTER AMOUNT
---------------------------------------------------------------------------------------------
833272 H70240 ARCHER DANIELS MIDLAND COMPANY 20,261.12
H71270
H71279
H72322
............................... as in HTML format, but PDF returns with below output:

CUSTOMER: Regression Print File
DATE: 6 16, 2009

CHECK NO. INVOICE NO. REMITTER AMOUNT
---------------------------------------------------------------------------------------------
833272 H70240 ARCHER DANIELS MIDLAND COMPANY 20,261.12
H71270
H71279
H72322

834762 H71264 ARCHER DANIELS MIDLAND COMPANY 14,008.32
H71281
H72218

.. Subsequent lines mis-aligned.

FYI, This was working fine with older version of 3.4 DLL. Can you specify what properties need to be set to retain HTML nature of the content?

Hi Srinivasa,


I received an email on 20Nov2012 with an attachment containing XMl, XSL and code file. Later on I received another email on 26Nov2012 with an attachment containing Aspose.Pdf.TruetypeFontMap.xml file and as I have shared earlier, I am getting error message during XML loading. I have again tested the scenario and I am still getting the same error message. Can you please take a look over the following image file which shows the exception and the point where I am getting this problem. We are really sorry for this inconvenience.

PS, Nevertheless, I have also asked my fellow worker to test this scenario over his end.

Hi,
I am using .Net 4.0 and xmlDocument.LoadXML() only has String as argument, not path as in your attachment/snapshot. I copied the file content to String Property "s" as in Attachment and LoadXML() loads to the document and shows in MessageBox.. Can you please use it as String as well?
Thanks
Srini

Hi Srini,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I tried using the XML string instead of file path but I am getting “'\' is an unexpected token. The expected token is '"' or '''. Line 1, position 15.” Exception. When I checked your shared XML file, it is using a lot of unexpected “\” characters in tags. I tried opening the XML file in XML Editor and it does not open it as well. Please share your XML file again with your sample application so we can sort out the problem soon.

We are sorry for the inconvenience,