XSL FO to PDF using Aspose.PDF for .NET - Exception occured during import of source Xslfo

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

@rui.jia0408

Would you please share your sample source files in .zip format with us. We will test the scenario in our environment and address it accordingly.

Hello,

Please check the sample source file we used in the attachement.

test_Aspose.zip (4.1 KB)

Actually we use the Aspose.pdf for two of our projects, it’s working properly in one of them, but not another one. I have run the tests with both of the version we currently used (18.2) and the newest one (20.10), and I still get the same issues specified in my last comment.

Please let me know if you need anything else.

Cheers,
Rui

@rui.jia0408

We were able to reproduce the issue in our environment while using Aspose.PDF for .NET 20.10. Therefore, have logged an issue as PDFNET-48947 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello ,

Thanks for your information. So please let me know when you will include the correction about the issue.

Cheers,
Rui

@rui.jia0408

We will surely post updates within this forum thread as soon as the ticket is resolved.

Hello @asad.ali,

Do you have any updates about this issue since it has been a long time.

And FYI, I noticed that the issue reported is linked to the formatting object fo:marker/fo:retrieve-marker, we have this issue for all the xslfo with fo:marker set, just like the one I attaced as exemple. But we don’t face this issue when the fo:marker is empty. I think this is linked to the fact we use the fo:retrieve-marker to display some information in the footer, maybe the fo:retrieve-marker is not supported by Aspose library.

Can you please check this in your side?

Thanks,
Rui

@rui.jia0408

We are afraid that earlier logged ticket is not yet fully investigated. However, we have recorded the information provided by you and will surely consider it during performing the investigation. We will inform you as soon as we have some definite updates regarding issue rectification. Please spare us little time.

We are sorry for the inconvenience.

Hi @asad.ali

Does this ticket has been investigated?

Thx,

Nicolas

@nparisse

We are afraid that the earlier logged ticket could not get resolved yet. We will certainly post an update in this forum thread once the issue is fixed.

We apologize for the inconvenience.

Hi @asad.ali

How is going the investiguation on this ticket?

Thx,

Nicolas

@nparisse

We regret to share that the earlier logged ticket has not been full investigated yet due to other issues logged prior to it. As soon as it is completely analyzed, we will be able to share some updates regarding its fix ETA with you. We highly appreciate your patience and comprehension in this matter. Please give us some time.

We apologize for the inconvenience.

Hi @asad.ali

Any news about this ticket?
Is it being corrected?

Thx,

Nicolas

@nparisse

We will surely investigate and resolve the issue. However, we really apologize for the delay in ticket resolution. There have been other issues in the queue which were logged prior to this ticket and we have been busy in resolving and investigating them. We will surely update this forum thread as soon as we make some definite progress towards ticket fix. We highly appreciate your patience in this matter.

We apologize for the inconvenience.

Hi @asad.ali

This ticket was created a year ago. The highlighted issue is a blocker to fully migrate our application to Aspose for PDF generation.

The impacted application and client provide services to roughly 4M people. All of these users are being affected by the slowness of Aspose’s support. Why is this taking so long?

Please provide detailed feedback and schedule for this ticket resolution so that we can communicate with our client and/or consider other PDF generation solutions.

Regards,

Nicolas

@nparisse

Please accept our humble apology for the inconvenience and delay you have been facing. We have recorded your concerns and escalated the issue to the next level of priority. We will surely try to complete its investigation and share some reliable ETA with you. We greatly appreciate your patience and comprehension in this regard. Please spare us little time.

We again apologize for the inconvenience faced.