I am trying to generate a dynamic PDF with 'PDF from XSL FO Transformation', it is generating a PDF but after opening it I'm getting an error stating 'The file is damaged and could not be repaired.' Has anyone came across such scenario? I'm not able find the issue here.
Discussion posts and replies are publicly visible
Hello Deepanshua,
That error is commonly found when the XSL-FO is not well formed and/or the commands were not interpreted by the Apache FOP library.
Lot of the comments from the others might help you, what I recommend you to do is the following.
Since you are working with multiple languages at the same time(I always use the analogy with the JSP which includes html-java or php).
Here you are mixing he XSLT(xml2xml transformation) and the FO(pdf structure) tags.
First make sure your FO part is working as expected.
So use the XSL-Transformation (the first section the input is the xml and The XSL) from:
BY doing this you will get the pure FO file(I always recommend start with this then create the xsl)
When you have this file you can review your tags and make sure that’s what you want as pdf. If the error still happen, remove sections so you can figure it out which is the cause of the error. To test it use the second section of the link above to debug the FO file.
When ready now tweak your original XSL-Fo File to correct the issue.
What can be happening is that the transformation is not making the things right, and it is creating an FO file with sintax problems or not valid tags. That why it’s better to first create the FO file, make sure that’s the PDF you want and then deal with the xml transformation.
Hope this helps.
Please feel free to ask if you have more problems, if that’s the case if you can share any file that might help to see the your issue.
Jose
Hi Chanakya,
I am sending the xslt file in the xsl document input of the plugin. I am getting the same issue of corrupted pdf. could you let me know how you resolved this issue?
Thanks
Hello Himanshu,
Have you tested the XSLT with the xml in any XMLs tool? The complexity of doing this is that you are merging 2 languages the first is the XSLT and the second is the what I call the FO syntax
If the ending xlsfo has wrong syntax or an invalid xml tag that kind of error could happen