Aspose.PDF  for Java

XSLFO File Viewer for Java

View XSLFO documents in a browser without needing Adobe Acrobat or Automation with Java.

How to view XSLFO files Using Java Library

In order to view XSLFO, we’ll use Aspose.PDF for Java API which is a feature-rich, powerful and easy to use conversion API for Java platform. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml.


    <name>Aspose Java API</name>



    <version>version of aspose-pdf API</version>


View XSLFO files via Java

You need Aspose.PDF for Java to try the code in your environment.

  1. Load the XSLFO with an instance of Document.
  2. View resultant File.

System Requirements

Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
  • Development environment like Eclipse or IntelliJ IDEA.
  • Aspose.PDF for Java library referenced in your project.

Java - example code to view XSLFO file.

 // Instantiate XslFoLoadOption object
    var options = new XslFoLoadOptions(".\\samples\\employees.xslt");
    // Set error handling strategy
    options.ParsingErrorsHandlingType = XslFoLoadOptions.ParsingErrorsHandlingTypes.ThrowExceptionImmediately;
    // Create Document object
    var pdfDocument = new Aspose.Pdf.Document(".\\samples\\employees.xml", options);
    pdfdocument.save(_dataDir + "data_xml.pdf");

About Aspose.PDF for Java API

Check our live demos to View PDF with following benefits.

Free App to View XSLFO