You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Koon Sang <ko...@igine.com> on 2010/04/16 04:38:10 UTC
Multi-lingual suport for FOP in OFBIZ 9.04?
Hello,
I tried to generate PDF files in OFBIZ 9.04 using FOP. The Chinese
characters appear as ### in the PDF file. Any one can advise?
Thanks!
--
View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p1934541.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Here are the changes that I did (but I have tested only with trunk, not 09.04):
framework/webapp/config/simhei.ttf
framework/webapp/config/simhei.xml
Index: framework/webapp/config/fop.xconf
===================================================================
--- framework/webapp/config/fop.xconf (revision 935959)
+++ framework/webapp/config/fop.xconf (working copy)
@@ -82,6 +82,14 @@
| 500 | 600 | 700 | 800 | 900
(normal = 400, bold = 700)
-->
+ <font metrics-url="simhei.xml" kerning="yes" embed-url="simhei.ttf">
+ <font-triplet name="SimHei" style="normal" weight="normal"/>
+ <font-triplet name="SimHei" style="normal" weight="bold"/>
+ </font>
Index: framework/common/widget/CommonScreens.xml
===================================================================
--- framework/common/widget/CommonScreens.xml (revisione 929148)
+++ framework/common/widget/CommonScreens.xml (copia locale)
@@ -373,8 +374,9 @@
<set field="layoutSettings.shortcutIcon" value="/images/ofbiz.ico" global="true"/>
<!-- The settings below are used for xsl-fo screens -->
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<set field="logoImageUrl" value="/images/ofbiz_logo.gif"/>
- <!--<set field="defaultFontFamily" value="Arial"/>-->
+ <set field="defaultFontFamily" value="SimHei"/>
</actions>
<widgets>
<!-- render header -->
@@ -392,8 +394,9 @@
<section>
<actions>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<set field="logoImageUrl" value="/images/ofbiz_logo.gif"/>
- <!--<set field="defaultFontFamily" value="Arial"/>-->
+ <set field="defaultFontFamily" value="SimHei"/>
</actions>
<widgets>
<platform-specific><xsl-fo><html-template location="component://common/webcommon/includes/reportTemplate.fo.ftl"/></xsl-fo></platform-specific>
On Apr 22, 2010, at 3:32 AM, Koon Sang wrote:
>
> Hello,
>
> I managed to solve the mystery. The problem is because OFBIZ does not load
> xalan-2.7.0.jar and serializer-2.7.0.jar during startup. I added the jar
> files in the startup script via classpath but it does not work either.
> Therefore, I modified org.ofbiz.base.start.Start to load all jar under
> ofbiz\framework\webapp\lib and it works.
>
> Summary of how I made it work for me:
>
> 1. Generate xml for the ttf I want (Refer to section on TrueType Font Metric
> at http://xmlgraphics.apache.org/fop/0.94/fonts.html)
> 2. Copy the xml and ttf to ofbiz\framework\webapp\config
> 3. Put the following in fop.xconf:
>
> <font-triplet name="SimHei" style="normal" weight="normal"/>
>
> 4. In the *.fo.ftl, set font-family, e.g.:
> <fo:block font-size="5pt" font-family="SimHei"
> font-weight="bold">${product.internalName?if_exists}</fo:block>
>
> Not sure whether I am doing the right thing or following the good practices,
> but it works for me. Thanks for all the pointers, anyway.
>
> --
> View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p2019928.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Koon Sang <ko...@igine.com>.
Hello,
I managed to solve the mystery. The problem is because OFBIZ does not load
xalan-2.7.0.jar and serializer-2.7.0.jar during startup. I added the jar
files in the startup script via classpath but it does not work either.
Therefore, I modified org.ofbiz.base.start.Start to load all jar under
ofbiz\framework\webapp\lib and it works.
Summary of how I made it work for me:
1. Generate xml for the ttf I want (Refer to section on TrueType Font Metric
at http://xmlgraphics.apache.org/fop/0.94/fonts.html)
2. Copy the xml and ttf to ofbiz\framework\webapp\config
3. Put the following in fop.xconf:
<font-triplet name="SimHei" style="normal" weight="normal"/>
4. In the *.fo.ftl, set font-family, e.g.:
<fo:block font-size="5pt" font-family="SimHei"
font-weight="bold">${product.internalName?if_exists}</fo:block>
Not sure whether I am doing the right thing or following the good practices,
but it works for me. Thanks for all the pointers, anyway.
--
View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p2019928.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Koon Sang <ko...@igine.com>.
Hi Christian,
Thanks for the response.
I have tried both the following but failed:
<font-triplet name="SimHei" style="normal" weight="normal"/>
and
<font-triplet name="SimHei" style="normal" weight="normal"/>
where in the second case, I put both the simhei.xml and simhei.ttf in
d:\ofbiz\framework\widget\config
Even if I remove the above and just put in the following, it failed too:
<fonts>
<auto-detect/>
</fonts>
I got the same exception in any of the attempts above. Hope you can advise.
Thank you.
--
View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p2016784.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Christian Geisert <ch...@isu-gmbh.de>.
Koon Sang schrieb:
> Hi,
>
> I followed the 2-steps instruction given by Zhiyongcui at
> http://n4.nabble.com/simplified-chinese-problem-td1565879.html#a1565903 but
> still cannot get it to generate proper Chinese characters. Not sure what
> have I missed.
>
> I have generated simhei.xml and put the following in fop.xconf:
>
>
> <font-triplet name="SimHei" style="normal" weight="normal"/>
What is the content of <font metrics-url=" ?
> I copied c:\windows\fonts\simhei.ttf and simhei.xml to
> framework/webapp/config.
>
> When I tried to generate any PDF file, I got the following exception:
>
> java.lang.NoClassDefFoundError:
> org/apache/xml/utils/URI$MalformedURIException
> org.apache.fop.fonts.FontCache.addFont(FontCache.java:246)
This seems to be a subsequent error resulting from a wrong metrics-url
(but this NoClassDefFoundError error shouldn't happen, I'll check if a
jar is missing)
[..]
> In fact, I got the same exception even with the following in fop.xconf:
>
> <fonts>
> <auto-detect/>
> </fonts>
This should work (remove the custom font from fop.xconf), just reference
the font with the correct Name.
Christian
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Koon Sang <ko...@igine.com>.
Hi,
I followed the 2-steps instruction given by Zhiyongcui at
http://n4.nabble.com/simplified-chinese-problem-td1565879.html#a1565903 but
still cannot get it to generate proper Chinese characters. Not sure what
have I missed.
I have generated simhei.xml and put the following in fop.xconf:
<font-triplet name="SimHei" style="normal" weight="normal"/>
I copied c:\windows\fonts\simhei.ttf and simhei.xml to
framework/webapp/config.
When I tried to generate any PDF file, I got the following exception:
java.lang.NoClassDefFoundError:
org/apache/xml/utils/URI$MalformedURIException
org.apache.fop.fonts.FontCache.addFont(FontCache.java:246)
org.apache.fop.fonts.autodetect.FontInfoFinder.fontInfoFromCustomFont(FontInfoFinder.java:112)
org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:169)
org.apache.fop.render.PrintRendererConfigurator.addFontInfoListFromFileList(PrintRendererConfigurator.java:222)
org.apache.fop.render.PrintRendererConfigurator.buildFontListFromConfiguration(PrintRendererConfigurator.java:182)
org.apache.fop.render.PrintRendererConfigurator.configure(PrintRendererConfigurator.java:93)
org.apache.fop.render.pdf.PDFRendererConfigurator.configure(PDFRendererConfigurator.java:70)
org.apache.fop.render.RendererFactory.createRenderer(RendererFactory.java:187)
org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:70)
org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:126)
org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:101)
org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:224)
org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:99)
org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:147)
org.apache.fop.apps.Fop.<init>(Fop.java:82)
org.apache.fop.apps.FopFactory.newFop(FopFactory.java:249)
org.ofbiz.webapp.view.ApacheFopWorker.createFopInstance(ApacheFopWorker.java:170)
org.ofbiz.widget.screen.ScreenFopViewHandler.render(ScreenFopViewHandler.java:99)
org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:789)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:533)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:201)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:259)
In fact, I got the same exception even with the following in fop.xconf:
<fonts>
<auto-detect/>
</fonts>
Can any one kindly advise what is amiss?
Thank you.
--
View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p2015658.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Brajesh Patel <br...@hotwaxmedia.com>.
Hello Koon,
Please refer following mail with subject: "Simplified Chinese characters
are displayed as square boxes in POS" and "simplified chinese problem",
also go for page http://cwiki.apache.org/confluence/x/9ABk .
you will get solution for your problem.
Thanks & Regards
Brajesh Patel
Koon Sang wrote:
> Hello,
>
> I tried to generate PDF files in OFBIZ 9.04 using FOP. The Chinese
> characters appear as ### in the PDF file. Any one can advise?
>
> Thanks!
>
Re: Multi-lingual suport for FOP in OFBIZ 9.04?
Posted by Adrian Crum <ad...@yahoo.com>.
Search the mailing list for "FOP fonts"
-Adrian
--- On Thu, 4/15/10, Koon Sang <ko...@igine.com> wrote:
> From: Koon Sang <ko...@igine.com>
> Subject: Multi-lingual suport for FOP in OFBIZ 9.04?
> To: user@ofbiz.apache.org
> Date: Thursday, April 15, 2010, 7:38 PM
>
> Hello,
>
> I tried to generate PDF files in OFBIZ 9.04 using
> FOP. The Chinese
> characters appear as ### in the PDF file. Any one can
> advise?
>
> Thanks!
> --
> View this message in context: http://n4.nabble.com/Multi-lingual-suport-for-FOP-in-OFBIZ-9-04-tp1934541p1934541.html
> Sent from the OFBiz - User mailing list archive at
> Nabble.com.
>