Issue with upgrade from FOP 0.95 to 2.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with upgrade from FOP 0.95 to 2.0

Kandula, Naveen

Hi,

We have been using fop to generate the PDF’s from xml in various languages and we were using FOP 0.95 version.

Now, We are planning to migrate from FOP version 0.95 to 2.0.

 

Below is the piece of code which we were using with FOP 0.95

FopFactory fopFactory = FopFactory.newInstance();

FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

TransformerFactory factory = TransformerFactory.newInstance();

Transformer transformer = factory.newTransformer(new StreamSource(xsltfile));

 

// for korean PDF

if (langPref.equalsIgnoreCase("ko-kr"))

{

foUserAgent.setFontBaseURL("file:///usr/share/X11/fonts/TrueType/korean.st/typefaces/");

fopFactory.setUserConfig(new File(scriptsRoot + " /prds/korean.xml"));

}

 

Now, with 2.0, I do not see setFontBaseURL method under foUserAgent class.

 

I tried something like below

 

DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();

Configuration cfg = cfgBuilder.buildFromFile(new File(scriptsRoot + "/prds/korean.xml"));

FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new File(".").toURI()).setConfiguration(cfg);

FopFactory fopFactory = fopFactoryBuilder.build();

 

 

But I am really not sure how can I set FontBaseURL with version 2.0. I could not able to generate the pdf’s in local languages.

 

 

Any assistance here would be greatly appreciated.

 

Thanks In Advance.

 

Thanks

Naveen






CONFIDENTIALITY NOTICE: This message (including any attachments) may contain Molex confidential information, protected by law. If this message is confidential, forwarding it to individuals, other than those with a need to know, without the permission of the sender, is prohibited.

This message is also intended for a specific individual. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message or taking of any action based upon it, is strictly prohibited.

English | Chinese | Japanese
www.molex.com/confidentiality.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with upgrade from FOP 0.95 to 2.0

Chris Bowditch
Hi Naveen,

This has been reported before at [1] Simon made a suggestion to put
font-base into the config file, and call API a different way. Can you
try that?

Thanks

Chris

[1] https://issues.apache.org/jira/browse/FOP-2600

On 04/10/2016 17:26, Kandula, Naveen wrote:

>
> Hi,
>
> We have been using fop to generate the PDF’s from xml in various
> languages and we were using FOP 0.95 version.
>
> Now, We are planning to migrate from FOP version 0.95 to 2.0.
>
> Below is the piece of code which we were using with FOP 0.95
>
> _FopFactory_fopFactory = _FopFactory_.newInstance();
>
> _FOUserAgent_foUserAgent = fopFactory.newFOUserAgent();
>
> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
>
> TransformerFactory factory = TransformerFactory./newInstance/();
>
> Transformer transformer =
> factory.newTransformer(*new*StreamSource(xsltfile));
>
> // for korean PDF
>
> *if*(langPref.equalsIgnoreCase("ko-kr"))
>
> {
>
> foUserAgent.setFontBaseURL("file:///usr/share/X11/fonts/TrueType/korean.st/typefaces/");
>
> fopFactory.setUserConfig(*new*File(scriptsRoot + " /prds/korean.xml"));
>
> }
>
> Now, with 2.0, I do not see setFontBaseURL method under foUserAgent class.
>
> I tried something like below
>
> DefaultConfigurationBuilder cfgBuilder =
> *new*DefaultConfigurationBuilder();
>
> Configuration cfg = cfgBuilder.buildFromFile(*new*File(scriptsRoot +
> "/prds/korean.xml"));
>
> FopFactoryBuilder fopFactoryBuilder =
> *new*FopFactoryBuilder(*new*File(".").toURI()).setConfiguration(cfg);
>
> FopFactory fopFactory = fopFactoryBuilder.build();
>
> But I am really not sure how can I set FontBaseURL with version 2.0. I
> could not able to generate the pdf’s in local languages.
>
> Any assistance here would be greatly appreciated.
>
> Thanks In Advance.
>
> Thanks
>
> Naveen
>
>
> ------------------------------------------------------------------------
>
>
>
> CONFIDENTIALITY NOTICE: This message (including any attachments) may
> contain Molex confidential information, protected by law. If this
> message is confidential, forwarding it to individuals, other than
> those with a need to know, without the permission of the sender, is
> prohibited.
>
> This message is also intended for a specific individual. If you are
> not the intended recipient, you should delete this message and are
> hereby notified that any disclosure, copying, or distribution of this
> message or taking of any action based upon it, is strictly prohibited.
>
> English | Chinese | Japanese
> www.molex.com/confidentiality.html



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]