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

  • SEARCH
  • Home
  • 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 6686401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:10:03+00:00 2026-05-26T05:10:03+00:00

I am looking to update an application to use the newest fop API. The

  • 0

I am looking to update an application to use the newest fop API.
The application uses version 0.20 of the library, for example the Driver class is still being used.

I do not seem to be able to find any sensible information on how to update to the newest fop version. I found some snippets, eg that the FOPFactory should be used.

So I was wondering if anyone could give me a push to resources on updating to the new(est) fop API?
Or is it not really possible to update and do I need to rewrite this part of the application?

PS I have found the fop upgrading page (of course) but it does not seem to point out the similarities between classes/APIs of both versions.

  • 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-05-26T05:10:03+00:00Added an answer on May 26, 2026 at 5:10 am

    The answer is that it really depends on how much you use of FOP.

    When we updated from a .2* version to the .9, then 1.0 version, we had to revise quite a bit, but we generated a large variety of FO (we transformed FO to PostScript) and we needed to generate a variety of PostScripts to see what worked and what failed in the newer versions. You will likely find an easy replacement for anything that might have vanished based on what you used to do.

    We had, luckily, consolidated references to the Driver and Fop classes to a custom utility and therefore it wasn’t so bad a transition to simply swap out a new utility reference that used the FopFactory.

    Your first step should be to write an abstract Facade as @Wivani suggests to consolidate your older fop reference calls, make sure that works in your code, then move forward by replacing your older Facade with an implementation that uses the newer code.

    The only thing that has displeased me about Fop is that the community takes quite a while to apply bug patches and generate new releases. We used v1 in production with XML Graphics 1.4 with no problems (basic FO to generate PostScript and TIFF files).

    I will supplement this post on Monday with some helper code if you need it.

    UPDATE
    Here is what we used to use to convert a FO file to PostScript:

    String foAsString = "your_fo_as_string";
    File destination = new File("path_to_file"");
    
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(destination));
    Driver driver = new Driver(new InputSource(new StringReader(foAsString)), out);
    driver.setRenderer(Driver.RENDER_PS);
    driver.run();
    
    out.close();
    
    return destination;
    

    Here is an abstract of what we use now.

    FopFactory is created as instance-level as

    this.fopFactory = FopFactory.newInstance();
    

    code:

    import javax.xml.transform.Source;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.sax.SAXResult;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    
    import org.apache.fop.apps.Fop;
    import org.apache.fop.apps.FopFactory;
    import org.apache.fop.apps.MimeConstants;
    
    // ...
    
    String foAsString = "your_fo_as_string";
    File destination = new File("path_to_file"");
    
    OutputStream outStream = new BufferedOutputStream(new FileOutputStream(destination));
    Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, outStream);
    
    Transformer transformer = transformerFactory.newTransformer();
    Source source = new StreamSource(new StringReader(foAsString));
    Result result = new SAXResult(fop.getDefaultHandler());
    
    transformer.transform(source, result);
    
    outStream.close();
    
    return destination;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to build a web site/application. The class model is around 100
We are currently planning an application and are looking to use Hibernate. The database
I'm currently building a Spring MVC application. I was looking to use JSP pages
Hello I am looking to build a basic API and application/apps system on my
I'm looking to use Lithium framework to build my application config interface as I
I'm looking to update a MySQL database with items from an RSS Feed. When
I am looking to update rows where the date column is NULL by averaging
Looking at all the possibilites of creation / update columns in NHibernate I mostly
Looking for a good tutorial on how to update a mysql database using a
I'm looking forward to have an update on the following topic as it does

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.