Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:24:37+00:00 2026-06-05T19:24:37+00:00

I am trying to generate on-the-fly PDF reports from Java objects. I have not

  • 0

I am trying to generate on-the-fly PDF reports from Java objects. I have not been able to find many examples of this, so I have been following this example:

http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup

The only real difference between this code and my own is that I generate src (line 81 in the example) using JSON conversion and an XMLSerializer.

The problem I run into is using the Transformer. When I do the transform (line 87 of the example), I receive the error message:

(Location of error unknown)org.apache.fop.fo.ValidationException:
First element must be the fo:root formatting object. Found (Namespace
URI: "", Local Name: "html") instead. Please make sure you're
producing a valid XSL-FO document.

Since I don’t have visibility into the Transformer, and haven’t been able to find the kind of documentation to tell me how it is supposed to work, I don’t really know where the transformation is breaking down.

Any experience with this kind of conversion, or understand of whatever it is I’m missing is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:24:38+00:00Added an answer on June 5, 2026 at 7:24 pm

    The input of Apache FOP is XSL:FO. The error message is saying that the input is not a valid XSL:FO document because the first (root) element is expected to be “fo:root” but “html” was found. FOP does not read HTML input. I suggest to break down the code in smaller steps and save the intermediate documents to help you identify the problem. The steps are:

    1. JSON object is serialized to XML
    2. XML is transformed using an XSLT to XSL:FO
    3. XSL:FO is transformed using FOP to PDF.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate a pdf on a fly at runtime from a
I am trying to generate Java documentation in Eclipse. The source files are UTF-8
I hwas trying to generate a multi page XPS document from a web application
I'm posting this for a friend. He is not able to access Stackoverflow from
I have been trying to create an application to go through our database at
while trying to generate a proxy from this WebService (http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl) I'm receiving this error
I'm trying to generate reports. I already created the HTML table in a view
I'm trying to generate a Java Client with the axis using wsdl2java (wrapped by
I'm trying to generate emails with rendered PDF attachements using ActionMailer and wicked_pdf. On
I have a WCF service which I am trying to use to generate an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.