Hello,
We’re currently using Aspose.Pdf for .Net to generate our PDF via un XSL-Fo, but we received this error during the initialization of Document.
—> [System.ApplicationException]: Exception occured during import of source Xslfo. *
Exception’s message is : ‘Unable to cast object of type ’ ’ to type ’ [ ]’.’ .\r\n Since in conversion’s options selected mode of ignoring validation errors, and such errors was detected, this exception can be result of that bad formatting. Here is list of found formatting errors : ============================================
Border and padding for fo:region-after “first-page-footer” should be ‘0’ (See 6.4.14 in XSL 1.1); non-standard values are allowed if relaxed validation is enabled.Line(7)\Col(8)---------------------------------
Border and padding for fo:region-after “repeat-page-footer” should be ‘0’ (See 6.4.14 in XSL 1.1); non-standard values are allowed if relaxed validation is enabled.Line(12)\Col(8)---------------------------------
“fo:block-container” is missing) child elements.[ Required content model: marker (%block;)+] Line(29)\Col(16)---------------------------------
“fo:static-content” is missing) child elements.[ Required content model: (%block;)+] Line(67)\Col(6)============================================
- at . (Exception , )*
- at . (Document , Stream , XslFoLoadOptions )*
- at Aspose.Pdf.Document. (Stream , LoadOptions )*
- at Aspose.Pdf.Document…ctor(String filename, LoadOptions options)*
After several tests, I managed to correct all the format issues mentionned. But I still get the following issue:
[System.InvalidCastException]: Unable to cast object of type ’ ’ to type ’ [ ]’.
- at . (Exception , )*
- at . (Document , Stream , XslFoLoadOptions )*
- at Aspose.Pdf.Document. (Stream , LoadOptions )*
- at Aspose.Pdf.Document…ctor(String filename, LoadOptions options)*
- at ptoKernel.ReportHelper.AsposeReportGeneration.GeneratePdfWithAspose(String foInputPath, String pdfOutputPath)
Here are the codes where I tryied to create a document with and input of xsl fo file.
Dim options As XslFoLoadOptions = New XslFoLoadOptions()
Using pdfGenerated As Document = New Document(foInputPath, options)
pdfGenerated.Save(pdfOutputPath)
End Using
And we use the XslCompiledTransform to transform a xsl and xml file to the xsl fo file.
Basically I think there is an issue for Aspose to load the xsl fo file, can you help on this?
Cheers,
Rui