[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-user
Subject:    Re: FOP 1.1 to 2.0 Migration Guidance?!?
From:       Chris Bowditch <bowditch_chris () hotmail ! com>
Date:       2015-06-11 7:18:12
Message-ID: BLU437-SMTP637F7AC1945B27DE03305FFBBC0 () phx ! gbl
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic