Free Support Forum - aspose.com

XSL-FO to PDF Query

Looking at the Aspose.Pdf Java Component, and specifically the example com.aspose.pdf.examples.asposepdfgenerator.conversion.XSLFOToPDF. It reports it as "XSL-FO to PDF conversion example will be available very soon."


Can I confirm;
1) Does the conversion work and it’s purely the example which needs to be done?

2) Does the code conversion also need to be finished implemented as well as the example?

Hi John,


Thanks for your inquiry. XSL-FO to PDF is supported in Aspose.Pdf for Java. Please check following sample code snippet and please check currently supported XSL-FO supported elements details.

Moreover, can you please point me the examples you are referring, so will fix it asap.


com.aspose.pdf.XslFoLoadOptions
options = new com.aspose.pdf.XslFoLoadOptions();<o:p></o:p>

String inFile = "XSL-FO_corrected.fo";

Document newDoc = new Document(inFile, options);

String outPdfFile="XSL-FO_output.pdf";

newDoc.save(outPdfFile);


Please feel free to contact us for any further assistance.


Best Regards,

It’s at your github account, url to the specific class is;
https://github.com/asposepdf/Aspose_Pdf_Java/blob/master/Examples/src/main/java/com/aspose/pdf/examples/asposepdfgenerator/conversion/XSLFOToPDF.java

Their are 124 examples in total within the Aspose_Pdf_java Example project that report as being available soon.

Using your code snippet with the supplied fo, xml and xsl files produces the following error.


I guess you’ll need to change your example to work with the evaluation license.

Exception in thread "main" class com.aspose.pdf.internal.p349.z9: At most 4 text fragments can be added in evaluation mode.

com.aspose.pdf.TextBuilder.m1(Unknown Source)

com.aspose.pdf.TextBuilder.appendText(Unknown Source)

com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

com.aspose.foundation.rendering.z16.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z10.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z10.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z29.accept(Unknown Source)

com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

com.aspose.pdf.z234.m1(Unknown Source)

com.aspose.pdf.ADocument.m1(Unknown Source)

com.aspose.pdf.ADocument.(Unknown Source)

com.aspose.pdf.Document.(Unknown Source)

com.aspose.pdf.examples.asposepdfgenerator.conversion.XSLFOToPDF.main(XSLFOToPDF.java:26)

at com.aspose.pdf.TextBuilder.m1(Unknown Source)

at com.aspose.pdf.TextBuilder.appendText(Unknown Source)

at com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

at com.aspose.foundation.rendering.z16.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z10.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z10.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z29.accept(Unknown Source)

at com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

at com.aspose.pdf.z234.m1(Unknown Source)

at com.aspose.pdf.ADocument.m1(Unknown Source)

at com.aspose.pdf.ADocument.(Unknown Source)

at com.aspose.pdf.Document.(Unknown Source)

at com.aspose.pdf.examples.asposepdfgenerator.conversion.XSLFOToPDF.main(XSLFOToPDF.java:26)


Hi John,

john.patrick3:
Using your code snippet with the supplied fo, xml and xsl files produces the following error.

I guess you'll need to change your example to work with the evaluation license.

Exception in thread "main" class com.aspose.pdf.internal.p349.z9: At most 4 text fragments can be added in evaluation mode.

com.aspose.pdf.TextBuilder.m1(Unknown Source)

com.aspose.pdf.TextBuilder.appendText(Unknown Source)

com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

com.aspose.foundation.rendering.z16.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z10.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z10.accept(Unknown Source)

com.aspose.foundation.rendering.z13.accept(Unknown Source)

com.aspose.foundation.rendering.z29.accept(Unknown Source)

com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

com.aspose.pdf.z234.m1(Unknown Source)

com.aspose.pdf.ADocument.m1(Unknown Source)

com.aspose.pdf.ADocument.(Unknown Source)

com.aspose.pdf.Document.(Unknown Source)

com.aspose.pdf.examples.asposepdfgenerator.conversion.XSLFOToPDF.main(XSLFOToPDF.java:26)

at com.aspose.pdf.TextBuilder.m1(Unknown Source)

at com.aspose.pdf.TextBuilder.appendText(Unknown Source)

at com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

at com.aspose.foundation.rendering.z16.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z10.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z10.accept(Unknown Source)

at com.aspose.foundation.rendering.z13.accept(Unknown Source)

at com.aspose.foundation.rendering.z29.accept(Unknown Source)

at com.aspose.pdf.ApsToPdfConverter.m1(Unknown Source)

at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

at com.aspose.pdf.z234.m1(Unknown Source)

at com.aspose.pdf.ADocument.m1(Unknown Source)

at com.aspose.pdf.ADocument.(Unknown Source)

at com.aspose.pdf.Document.(Unknown Source)

at com.aspose.pdf.examples.asposepdfgenerator.conversion.XSLFOToPDF.main(XSLFOToPDF.java:26)



Thanks for your feedback. Actually Aspose.Pdf evaluation version has two limitations, evaluation watermark and at most four elements of any collection can be viewed. You may request and implement a 30 days temporary license. Hopefully it will help you to evaluate our product without any issues.

Please feel free to contact us for any further assistance.

Best Regards,

The example I’m trying to execute is the example supplied by Aspose.

https://github.com/asposepdf/Aspose_Pdf_Java/blob/master/Examples/src/main/java/com/aspose/pdf/examples/asposepdfgenerator/conversion/XSLFOToPDF.java

https://github.com/asposepdf/Aspose_Pdf_Java/tree/master/Examples/src/main/resources/com/aspose/pdf/examples/asposepdfgenerator/conversion/xslfotopdf/

Hi John,


Thanks for your feedback. We will discuss the issue internally and will either add some intimation tag or some other way to inform customers regarding aspose.pdf (old generator) namespace future, until it is announced obsolete and removed from API.

Meanwhile we will recommend you to use com.aspose.pdf and com.aspose.facades namespaces.

Please feel free to contact us if you have some concern or query, we will glad to extend our support.

Best Regards,

Slightly confused by your last comment.


I am using the namespace of “com.aspose.pdf”, which is where I’m having issues.

To confirm I’m not using “aspose.pdf” and wasn’t aware it existed.

Hi John,


Please note that we used to have legacy Aspose.Pdf for Java which is included in latest release under aspose.pdf package. However com.aspose.pdf package is the new Document Object Model (DOM) approach and its the recommended one. Indeed we will be fixing the issue in new DOM.