UTF-8 characters in PDF

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

UTF-8 characters in PDF

Antoine.DE-TROOSTEMBERGH
UTF-8 characters in PDF

Hi,

I use the oxf:xslfo-serializer to generate PDFs.
Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
These characters are represented as # in the PDF.

Is there a way to make those characters appear?
I searched through the FOP documentation but I don't know how to implement this in the XPL.

Thanks,

Antoine



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: UTF-8 characters in PDF

Erik Bruchez
Administrator
Antoine,

It's been a while since we have looked at oxf:xslfo-serializer. The
processor is extremely simple, see:

http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/serializer/legacy/XSLFOSerializer.java

The XML input is XML so should support unicode. So I wonder why it
doesn't work for you. Maybe you can try a newer version of FOP, and/or
try to dig into the FOP documentation or support.

-Erik

On Tue, Aug 4, 2009 at 6:59 AM,
<[hidden email]> wrote:

> Hi,
>
> I use the oxf:xslfo-serializer to generate PDFs.
> Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
> These characters are represented as # in the PDF.
>
> Is there a way to make those characters appear?
> I searched through the FOP documentation but I don't know how to implement
> this in the XPL.
>
> Thanks,
>
> Antoine
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: UTF-8 characters in PDF

Antoine.DE-TROOSTEMBERGH
Hi Erik,

This processor is indeed very simple.
I've seen some pages on the internet with indications on how to create PDF with UTF-8 characters.
http://www.javaranch.com/journal/200409/CreatingMultipleLanguagePDFusingApacheFOP.html

The problem is that the default fonts used in FOP (eg. Helvetica) does not seem to be a trueType character.
Since I'm not realy a FOP specialist I'm not sure how to make the processor use an alternate font.

If anyone has any idea ...

Thanks,

Antoine

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Wednesday, August 05, 2009 7:32 AM
To: [hidden email]
Subject: [ops-users] Re: UTF-8 characters in PDF

Antoine,

It's been a while since we have looked at oxf:xslfo-serializer. The
processor is extremely simple, see:

http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/serializer/legacy/XSLFOSerializer.java

The XML input is XML so should support unicode. So I wonder why it
doesn't work for you. Maybe you can try a newer version of FOP, and/or
try to dig into the FOP documentation or support.

-Erik

On Tue, Aug 4, 2009 at 6:59 AM,
<[hidden email]> wrote:

> Hi,
>
> I use the oxf:xslfo-serializer to generate PDFs.
> Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
> These characters are represented as # in the PDF.
>
> Is there a way to make those characters appear?
> I searched through the FOP documentation but I don't know how to implement
> this in the XPL.
>
> Thanks,
>
> Antoine
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: RE: Re: UTF-8 characters in PDF

Antoine.DE-TROOSTEMBERGH
I found a solution to my UTF8 character problem:
I had to modify the existing XSLFOSerialiser as follows (I actually copied the processor and modified it):


                        // Setup FOP to output PDF
                        FopFactory fopFactory = FopFactory.newInstance();
                        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

                        URL configFileUrl = this.getClass().getClassLoader().getResource("fop-userconfig.xml");
                        if (configFileUrl == null) {
                                logger
                                                .error("FOP config file not found, please put the fop-userconfig.xml file into the classpath of the server, UTF-8 characters won't be displayed correctly");
                        } else {
                                File userConfigXml = new File(configFileUrl.getFile());
                                fopFactory.setUserConfig(userConfigXml);
                        }

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

                        // Send data to FOP
                        readInputAsSAX(context, INPUT_DATA, fop.getDefaultHandler());


The fop-userconfig.xml file contains the definition of your Unicode Font.
To generate this userconfig.xml file proceed as described here: http://www.javaworld.com/javaworld/jw-03-2005/jw-0328-xmlprinting.html?page=3

Hope this is usefull for someone,

Antoine

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Wednesday, August 05, 2009 3:56 PM
To: [hidden email]
Subject: [ops-users] RE: Re: UTF-8 characters in PDF

Hi Erik,

This processor is indeed very simple.
I've seen some pages on the internet with indications on how to create PDF with UTF-8 characters.
http://www.javaranch.com/journal/200409/CreatingMultipleLanguagePDFusingApacheFOP.html

The problem is that the default fonts used in FOP (eg. Helvetica) does not seem to be a trueType character.
Since I'm not realy a FOP specialist I'm not sure how to make the processor use an alternate font.

If anyone has any idea ...

Thanks,

Antoine

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Wednesday, August 05, 2009 7:32 AM
To: [hidden email]
Subject: [ops-users] Re: UTF-8 characters in PDF

Antoine,

It's been a while since we have looked at oxf:xslfo-serializer. The
processor is extremely simple, see:

http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/serializer/legacy/XSLFOSerializer.java

The XML input is XML so should support unicode. So I wonder why it
doesn't work for you. Maybe you can try a newer version of FOP, and/or
try to dig into the FOP documentation or support.

-Erik

On Tue, Aug 4, 2009 at 6:59 AM,
<[hidden email]> wrote:

> Hi,
>
> I use the oxf:xslfo-serializer to generate PDFs.
> Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
> These characters are represented as # in the PDF.
>
> Is there a way to make those characters appear?
> I searched through the FOP documentation but I don't know how to implement
> this in the XPL.
>
> Thanks,
>
> Antoine
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: RE: Re: UTF-8 characters in PDF

Erik Bruchez-3
Antoine, thanks for this patch!

-Erik

On Mon, Aug 31, 2009 at 8:35 AM,
<[hidden email]> wrote:

> I found a solution to my UTF8 character problem:
> I had to modify the existing XSLFOSerialiser as follows (I actually copied the processor and modified it):
>
>
>                        // Setup FOP to output PDF
>                        FopFactory fopFactory = FopFactory.newInstance();
>                        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>
>                        URL configFileUrl = this.getClass().getClassLoader().getResource("fop-userconfig.xml");
>                        if (configFileUrl == null) {
>                                logger
>                                                .error("FOP config file not found, please put the fop-userconfig.xml file into the classpath of the server, UTF-8 characters won't be displayed correctly");
>                        } else {
>                                File userConfigXml = new File(configFileUrl.getFile());
>                                fopFactory.setUserConfig(userConfigXml);
>                        }
>
>                        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outputStream);
>
>                        // Send data to FOP
>                        readInputAsSAX(context, INPUT_DATA, fop.getDefaultHandler());
>
>
> The fop-userconfig.xml file contains the definition of your Unicode Font.
> To generate this userconfig.xml file proceed as described here: http://www.javaworld.com/javaworld/jw-03-2005/jw-0328-xmlprinting.html?page=3
>
> Hope this is usefull for someone,
>
> Antoine
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Wednesday, August 05, 2009 3:56 PM
> To: [hidden email]
> Subject: [ops-users] RE: Re: UTF-8 characters in PDF
>
> Hi Erik,
>
> This processor is indeed very simple.
> I've seen some pages on the internet with indications on how to create PDF with UTF-8 characters.
> http://www.javaranch.com/journal/200409/CreatingMultipleLanguagePDFusingApacheFOP.html
>
> The problem is that the default fonts used in FOP (eg. Helvetica) does not seem to be a trueType character.
> Since I'm not realy a FOP specialist I'm not sure how to make the processor use an alternate font.
>
> If anyone has any idea ...
>
> Thanks,
>
> Antoine
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez
> Sent: Wednesday, August 05, 2009 7:32 AM
> To: [hidden email]
> Subject: [ops-users] Re: UTF-8 characters in PDF
>
> Antoine,
>
> It's been a while since we have looked at oxf:xslfo-serializer. The
> processor is extremely simple, see:
>
> http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/serializer/legacy/XSLFOSerializer.java
>
> The XML input is XML so should support unicode. So I wonder why it
> doesn't work for you. Maybe you can try a newer version of FOP, and/or
> try to dig into the FOP documentation or support.
>
> -Erik
>
> On Tue, Aug 4, 2009 at 6:59 AM,
> <[hidden email]> wrote:
>> Hi,
>>
>> I use the oxf:xslfo-serializer to generate PDFs.
>> Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
>> These characters are represented as # in the PDF.
>>
>> Is there a way to make those characters appear?
>> I searched through the FOP documentation but I don't know how to implement
>> this in the XPL.
>>
>> Thanks,
>>
>> Antoine
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing
>> list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: RE: Re: UTF-8 characters in PDF

Erik Bruchez-3
FYI we have now included this change.

-Erik

On Thu, Sep 17, 2009 at 4:26 PM, Erik Bruchez <[hidden email]> wrote:

> Antoine, thanks for this patch!
>
> -Erik
>
> On Mon, Aug 31, 2009 at 8:35 AM,
> <[hidden email]> wrote:
>> I found a solution to my UTF8 character problem:
>> I had to modify the existing XSLFOSerialiser as follows (I actually copied the processor and modified it):
>>
>>
>>                        // Setup FOP to output PDF
>>                        FopFactory fopFactory = FopFactory.newInstance();
>>                        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>>
>>                        URL configFileUrl = this.getClass().getClassLoader().getResource("fop-userconfig.xml");
>>                        if (configFileUrl == null) {
>>                                logger
>>                                                .error("FOP config file not found, please put the fop-userconfig.xml file into the classpath of the server, UTF-8 characters won't be displayed correctly");
>>                        } else {
>>                                File userConfigXml = new File(configFileUrl.getFile());
>>                                fopFactory.setUserConfig(userConfigXml);
>>                        }
>>
>>                        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outputStream);
>>
>>                        // Send data to FOP
>>                        readInputAsSAX(context, INPUT_DATA, fop.getDefaultHandler());
>>
>>
>> The fop-userconfig.xml file contains the definition of your Unicode Font.
>> To generate this userconfig.xml file proceed as described here: http://www.javaworld.com/javaworld/jw-03-2005/jw-0328-xmlprinting.html?page=3
>>
>> Hope this is usefull for someone,
>>
>> Antoine
>>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]]
>> Sent: Wednesday, August 05, 2009 3:56 PM
>> To: [hidden email]
>> Subject: [ops-users] RE: Re: UTF-8 characters in PDF
>>
>> Hi Erik,
>>
>> This processor is indeed very simple.
>> I've seen some pages on the internet with indications on how to create PDF with UTF-8 characters.
>> http://www.javaranch.com/journal/200409/CreatingMultipleLanguagePDFusingApacheFOP.html
>>
>> The problem is that the default fonts used in FOP (eg. Helvetica) does not seem to be a trueType character.
>> Since I'm not realy a FOP specialist I'm not sure how to make the processor use an alternate font.
>>
>> If anyone has any idea ...
>>
>> Thanks,
>>
>> Antoine
>>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez
>> Sent: Wednesday, August 05, 2009 7:32 AM
>> To: [hidden email]
>> Subject: [ops-users] Re: UTF-8 characters in PDF
>>
>> Antoine,
>>
>> It's been a while since we have looked at oxf:xslfo-serializer. The
>> processor is extremely simple, see:
>>
>> http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/serializer/legacy/XSLFOSerializer.java
>>
>> The XML input is XML so should support unicode. So I wonder why it
>> doesn't work for you. Maybe you can try a newer version of FOP, and/or
>> try to dig into the FOP documentation or support.
>>
>> -Erik
>>
>> On Tue, Aug 4, 2009 at 6:59 AM,
>> <[hidden email]> wrote:
>>> Hi,
>>>
>>> I use the oxf:xslfo-serializer to generate PDFs.
>>> Unfortunately the text I enter contain Cyrillic, chinese, ... Charachters.
>>> These characters are represented as # in the PDF.
>>>
>>> Is there a way to make those characters appear?
>>> I searched through the FOP documentation but I don't know how to implement
>>> this in the XPL.
>>>
>>> Thanks,
>>>
>>> Antoine
>>>
>>> --
>>> You receive this message as a subscriber of the [hidden email] mailing
>>> list.
>>> To unsubscribe: mailto:[hidden email]
>>> For general help: mailto:[hidden email]?subject=help
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>>
>>>
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: RE: Re: UTF-8 characters in PDF

pappleby
Out of Office AutoReply: RE: Re: UTF-8 characters in PDF

I am out of the office until 19th April

***********************************************************************************************

This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.

 

Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.

 

Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.

***********************************************************************************************

The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG