|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
how to embed Asian font while genrating PDF using FOP??I have been trying to embed Asian font while genrating PDF using FOP. I am not able to get a break through in this. I need a help as to how to configure the whole thing like-
1) Where to keep my metric file, Currently fop.xconf and metric file are in the same location 2) i have created a fop.xconf file which has the following data <renderers> <renderer mime="application/pdf"> <fonts> <font-triplet name="arialuni" style="normal" weight="normal"/> </fonts> </renderer> </renderers> 3) the arialuni.ttf font is placed in my directory D:/HEAD/applications/proj/font/ and the metric file is placed in D:/HEAD/applications/proj/config/ 4) In my java code i have the following code FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent userAgent = fopFactory.newFOUserAgent(); File userConfigXml = new File("D:/HEAD/applications/proj/config/fop.xconf"); fopFactory.setUserConfig(userConfigXml); fopFactory.setFontBaseURL("D:/HEAD/applications/proj/font/"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); File copyrightFile = new File(fileUpLoadTempDir + copyrightPdfFileName); outputStream = new FileOutputStream(copyrightFile); outputStream = new BufferedOutputStream(outputStream); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, outputStream); Transformer transformer = transformerFactory.newTransformer(new StreamSource(xslSource)); Source src = new DOMSource(copyrightDom); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); This is all i have done till now. I am trying to call the fop.xconf file from my java code. Still i am getting # for the Asian Character. Definitly i am missing somethign or the whole process should not be done this way. Please some one help me out to resolve this. Thankyou Regards Sumit |
|
|
Re: how to embed Asian font while genrating PDF using FOP??Sumit4dreams wrote:
Hi, > I have been trying to embed Asian font while genrating PDF using FOP. I am > not able to get a break through in this. I need a help as to how to > configure the whole thing like- > 1) Where to keep my metric file, You don't say which version of FOP you are using but if 0.95 or later then there is often no need to generate a metrics files and doing so puts you at a disadvantage since there are some features such as AFM Parsing that FOP only does when no metrics file is present. > 2) i have created a fop.xconf file which has the following data > <renderers> > <renderer mime="application/pdf"> > <fonts> > > <font-triplet name="arialuni" style="normal" weight="normal"/> Here is one problem you haven't define the font element as parent of font-triplet, e.g. <font embed-url="D:/HEAD/applications/promo/font/arialuni.ttf"> <font-triplet name="arialuni" style="normal" weight="normal"/> </font> > > </fonts> > </renderer> > </renderers> > HTH, Chris --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: how to embed Asian font while genrating PDF using FOP??Hi Chris,
First of all thankyou for replying to my query. I am totally new to FOP so i dont know all the feature of FOP. I am using the latest FOP version. The current problem is that in my application we genrate a copyright pdf. This was working fine with English character. But now Chinese users have been included and for them the Chinese font get displayed as #. What we feel is that iif we can have unicode encoding then this problem in pdf genration will never come if any other language is used other than english langauage. So actaully i am looking for general solution to resolve any issue which can come with any international language So can you please guide me what all things i need to do so that i can get the problem resolved. In the post i have previously shared the code for pdf genration. What else i need to do. Please let me know. I will really appreciate any kind of help on this. best regards Sumit
|
|
|
Re: how to embed Asian font while genrating PDF using FOP??On 02 Jul 2009, at 20:02, Sumit4dreams wrote:
Hi Sumit Apologies for the late follow-up... > First of all thankyou for replying to my query. > I am totally new to FOP so i dont know all the feature of FOP. > I am using the latest FOP version. > The current problem is that in my application we genrate a copyright > pdf. > This was working fine with English character. But now Chinese users > have > been included and for them the Chinese font get displayed as #. > What we feel is that iif we can have unicode encoding then this > problem in > pdf genration will never come if any other language is used other than > english langauage. Not necessarily. FOP 0.95 does not yet support font-selection, so you still have to take care that Arial Unicode always appears everywhere as the first specified font-family. If you have something like: <fo:block font-family="Helvetica,Arial Unicode,GungSeo"> and the block contains Chinese text, the Helvetica font will be used, and you will end up with the missing-glyph character '#' all over the place, even if the 'Arial Unicode' and 'GungSeo' fonts have been properly configured. > So actaully i am looking for general solution to resolve any issue > which can > come with any international language FOP Trunk does look at all the specified font-families, so FOP will try all fonts for each word. It then picks the first font-family that can display the most characters. (see behavior described at: http://xmlgraphics.apache.org/fop/trunk/fonts.html#selection) So, with FOP Trunk you should be able to happily mix English with Chinese without really having to do anything special (apart from making sure that the fonts are properly registered; see Chris' earlier suggestions) Regards, Andreas Andreas Delmelle mailto:andreas.delmelle.AT.telenet.be jabber: mandreas@... skype: adlm0608 --- --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: how to embed Asian font while genrating PDF using FOP??Hi Andreas,
Thanks for replying. I had been trying over the font embedding and finally i was able to embed the font. I wanted to use the default font option with fop-0.95 but i was not able to get it correctly. But through the use of font metric file i was able to get the things in place. Also i guess once the pdf is generated with embed fonts then the pdf is correctly viewed even in system where the embed font is not instaleld in the system. I tried to experiment this scenario in differnt machine and was able to see the pdf coming correctly, But wanted to learn from your experience of there is a flaw inmy understanding. Also currently i have been able to do this in Windows XP using Arialuni.ttf font (font family: Arial unicode MS) but our applicaition in production enviroenment runs in unix boxes. So now can you please guide me as to which font i should use for Unix enviroenmt which will serve like ArailUni.ttf i.e. cover most of the international langauge and is also a free distribution. Best Regards Sumit
|
| Free embeddable forum powered by Nabble | Forum Help |