You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jess Holle <je...@ptc.com> on 2015/06/08 14:52:10 UTC

FOP 1.1 to 2.0 Migration Guidance?!?

So I downloaded FOP 2.0 to use in place of 1.x for embedded use in 
creating PDFs from XSL-FO within Java server code.

Unfortunately:

 1. The extremely simple code using FOP 1.x does not compile with 2.0
      * No big deal but....
 2. It is unclear how one should modify 1.x code to use 2.0 APIs
 3. There appears to be no migration guidance in the documentation
    whatsoever
      * This is the real kicker -- given #2.

This issue starts with the very first line of FOP 1.x API calls:

    FopFactory ff = org.apache.fop.apps.FopFactory.newInstance();

What's the replacement for this line?  It's completely unclear from the 
documentation.

Any assistance here would be greatly appreciated.

--
Jess Holle


RE: FOP 1.1 to 2.0 Migration Guidance?!?

Posted by Simon Steiner <si...@gmail.com>.
Hi,

 

We have some examples here:

 

https://xmlgraphics.apache.org/fop/2.0/embedding.html

 

Thanks

 

From: Jess Holle [mailto:jessh@ptc.com] 
Sent: 08 June 2015 13:52
To: fop-users@xmlgraphics.apache.org
Subject: FOP 1.1 to 2.0 Migration Guidance?!?

 

So I downloaded FOP 2.0 to use in place of 1.x for embedded use in creating PDFs from XSL-FO within Java server code.

Unfortunately:

1.	The extremely simple code using FOP 1.x does not compile with 2.0

*	No big deal but....

2.	It is unclear how one should modify 1.x code to use 2.0 APIs
3.	There appears to be no migration guidance in the documentation whatsoever

*	This is the real kicker -- given #2.

This issue starts with the very first line of FOP 1.x API calls:

FopFactory ff = org.apache.fop.apps.FopFactory.newInstance();

What's the replacement for this line?  It's completely unclear from the documentation.

Any assistance here would be greatly appreciated.

--
Jess Holle


Re: FOP 1.1 to 2.0 Migration Guidance?!?

Posted by Chris Bowditch <bo...@hotmail.com>.
Hi Jesse,

The only difficult part of that code is the Font Base URL. Do you really 
need a font base URI that's different from the global base URI? Assuming 
you can just set Base URL instead, there is a sample on the embedding 
page that's quite similar to below, i.e.

DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(new 
File("C:/Temp/mycfg.xml")); // swap the file here for fopConfig in your code
fopFactoryBuilder = new 
FopFactoryBuilder(baseURI).setConfiguration(cfg); // swap baseURI for 
your own base URI

If you do need a different font base URI to the global base URI then it 
might be possible with custom resolver for the Font Manager, but since 
I've not done that before I'm not 100% certain about that.

Thanks,

Chris

On 08/06/2015 15:40, Jess Holle wrote:
> Okay, it's now clear that I could have just done:
>    FopFactory  fopFactory = FopFactory.newInstance( baseURI );
> That said, now I have code doing:
>    FopFactory fopFactory = FopFactory.newInstance();
>    String strFontbase = getFontbaseLocation();
>    File fopConfig = getConfigFile();
>    if (fopConfig.exists() && strFontbase != null){
>      fopFactory.setFontBaseURL(strFontbase);
>      fopFactory.setUserConfig(fopConfig);
>    }
> And once again, it is unclear how to convert this to the 2.0 APIs.
>
> --
> Jess Holle
>
> On 6/8/2015 9:03 AM, Jess Holle wrote:
>> Okay, perhaps I over-reacted a bit as it seems one can do:
>>    FopFactoryBuilder  fopFactoryBuilder = new FopFactoryBuilder( baseURI );
>>    FopFactory  fopFactory = fopFactoryBuilder.build();
>> and then have the remainder of the API work much as it used to (apart 
>> from FOUserAgent lacking any API for setting the base URI).
>>
>> Simple guidance to this effect would have been quite helpful, though!
>>
>> On 6/8/2015 7:52 AM, Jess Holle wrote:
>>> So I downloaded FOP 2.0 to use in place of 1.x for embedded use in 
>>> creating PDFs from XSL-FO within Java server code.
>>>
>>> Unfortunately:
>>>
>>>  1. The extremely simple code using FOP 1.x does not compile with 2.0
>>>       * No big deal but....
>>>  2. It is unclear how one should modify 1.x code to use 2.0 APIs
>>>  3. There appears to be no migration guidance in the documentation
>>>     whatsoever
>>>       * This is the real kicker -- given #2.
>>>
>>> This issue starts with the very first line of FOP 1.x API calls:
>>>
>>>     FopFactory ff = org.apache.fop.apps.FopFactory.newInstance();
>>>
>>> What's the replacement for this line?  It's completely unclear from 
>>> the documentation.
>>>
>>> Any assistance here would be greatly appreciated.
>>>
>>> --
>>> Jess Holle 
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.1 to 2.0 Migration Guidance?!?

Posted by Jess Holle <je...@ptc.com>.
Okay, it's now clear that I could have just done:

   FopFactory  fopFactory = FopFactory.newInstance( baseURI );

That said, now I have code doing:

   FopFactory fopFactory = FopFactory.newInstance();
   String strFontbase = getFontbaseLocation();
   File fopConfig = getConfigFile();
   if (fopConfig.exists() && strFontbase != null){
     fopFactory.setFontBaseURL(strFontbase);
     fopFactory.setUserConfig(fopConfig);
   }

And once again, it is unclear how to convert this to the 2.0 APIs.

--
Jess Holle

On 6/8/2015 9:03 AM, Jess Holle wrote:
> Okay, perhaps I over-reacted a bit as it seems one can do:
>    FopFactoryBuilder  fopFactoryBuilder = new FopFactoryBuilder( baseURI );
>    FopFactory  fopFactory = fopFactoryBuilder.build();
> and then have the remainder of the API work much as it used to (apart 
> from FOUserAgent lacking any API for setting the base URI).
>
> Simple guidance to this effect would have been quite helpful, though!
>
> On 6/8/2015 7:52 AM, Jess Holle wrote:
>> So I downloaded FOP 2.0 to use in place of 1.x for embedded use in 
>> creating PDFs from XSL-FO within Java server code.
>>
>> Unfortunately:
>>
>>  1. The extremely simple code using FOP 1.x does not compile with 2.0
>>       * No big deal but....
>>  2. It is unclear how one should modify 1.x code to use 2.0 APIs
>>  3. There appears to be no migration guidance in the documentation
>>     whatsoever
>>       * This is the real kicker -- given #2.
>>
>> This issue starts with the very first line of FOP 1.x API calls:
>>
>>     FopFactory ff = org.apache.fop.apps.FopFactory.newInstance();
>>
>> What's the replacement for this line?  It's completely unclear from 
>> the documentation.
>>
>> Any assistance here would be greatly appreciated.
>>
>> --
>> Jess Holle 


Re: FOP 1.1 to 2.0 Migration Guidance?!?

Posted by Jess Holle <je...@ptc.com>.
Okay, perhaps I over-reacted a bit as it seems one can do:

   FopFactoryBuilder  fopFactoryBuilder = new FopFactoryBuilder( baseURI );
   FopFactory  fopFactory = fopFactoryBuilder.build();

and then have the remainder of the API work much as it used to (apart 
from FOUserAgent lacking any API for setting the base URI).

Simple guidance to this effect would have been quite helpful, though!

On 6/8/2015 7:52 AM, Jess Holle wrote:
> So I downloaded FOP 2.0 to use in place of 1.x for embedded use in 
> creating PDFs from XSL-FO within Java server code.
>
> Unfortunately:
>
>  1. The extremely simple code using FOP 1.x does not compile with 2.0
>       * No big deal but....
>  2. It is unclear how one should modify 1.x code to use 2.0 APIs
>  3. There appears to be no migration guidance in the documentation
>     whatsoever
>       * This is the real kicker -- given #2.
>
> This issue starts with the very first line of FOP 1.x API calls:
>
>     FopFactory ff = org.apache.fop.apps.FopFactory.newInstance();
>
> What's the replacement for this line?  It's completely unclear from 
> the documentation.
>
> Any assistance here would be greatly appreciated.
>
> --
> Jess Holle