- From: Ashish Baijal <abaijal@gmail.com>
- Date: Tue, 2 Dec 2008 15:21:37 -0500
- To: "Jeremias Maerki" <dev@jeremias-maerki.ch>
- Cc: www-xsl-fo@w3.org
- Message-ID: <d091745d0812021221q1cbae8abi3d14d4a1f3873dad@mail.gmail.com>
Thanks for the reply The metrics file is not present in root. I had truncated the path for the forums. I made the change of removing the metric file. I got the following error [2008-12-02 14:07:23,467] [pool-1-thread-1] ERROR LazyFont - Failed to read font metrics file null java.io.IOException: Cannot load font: failed to create InputStream from Source for font file /usr/openwin/lib/X11/fonts/TrueType/Arial.ttf at org.apache.fop.fonts.FontLoader.openFontUri(FontLoader.java:143) at org.apache.fop.fonts.truetype.TTFFontLoader.read(TTFFontLoader.java:54) at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:164) at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:113) at org.apache.fop.fonts.LazyFont.load(LazyFont.java:126) at org.apache.fop.fonts.LazyFont.getAscender(LazyFont.java:233) at org.apache.fop.fonts.Font.getAscender(Font.java:96) at org.apache.fop.layoutmgr.BlockLayoutManager.initialize(BlockLayoutManager.java:87) at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutManager.java:118) at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:77) at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:145) at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:552) at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:137) at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:302) at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:264) at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:106) at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:234) at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:123) at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:340) at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169) at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:309) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107) at com.marsh.itg.ddeepa.services.blocal.blogic.document.utils.FopDocumentRenderSystem.renderDocument(FopDocumentRenderSystem.java:159) at com.marsh.itg.ddeepa.services.blocal.blogic.document.utils.RenderSystemDocumentRenderer$RenderSystemInputStreamProvider$1.run(RenderSystemDocumentRenderer.java:75) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) The new Config file is <font embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf"> <font-triplet name="Arial" style="normal" weight="normal"/> <font-triplet name="ArialMT" style="normal" weight="normal"/> <font-triplet name="arial" style="normal" weight="normal"/> </font> If I use the auto-detect option only (commenting other details) I get the following warning. PDF gets printed but the Font is Times. [2008-12-02 14:12:58,331] [pool-1-thread-3] WARN FontInfo - Font 'Arial,normal,400' not found. Substituting with 'any,normal,400'. Thanks for the help Ashish On Tue, Dec 2, 2008 at 2:28 PM, Jeremias Maerki <dev@jeremias-maerki.ch>wrote: > > On 02.12.2008 19:56:11 Ashish Baijal wrote: > > Hi > > > > I am creating a PDF in my application using XSL:FO > > > > Following are working perfectly in Windows server but when I deploy in > linux > > environment, the generation fails. > > > > FOP Version : 0.95 > > > > *Config file * > > <fonts> > > <!-- Windows Dev environment configuration > > <font metrics-url="/Arial.xml" kerning="yes" > > embed-url="file:///C:/WINDOWS/Fonts/arial.ttf"> > > <font-triplet name="Arial" style="normal" weight="normal"/> > > <font-triplet name="ArialMT" style="normal" weight="normal"/> > > <font-triplet name="arial" style="normal" weight="normal"/> > > </font> > > <font metrics-url="/ArialB.xml" kerning="yes" > > embed-url="file:///C:/WINDOWS/Fonts/arialbd.ttf"> > > <font-triplet name="Arial" style="normal" weight="bold"/> > > <font-triplet name="ArialMT" style="normal" weight="bold"/> > > <font-triplet name="arial" style="normal" weight="bold"/> > > </font> --> > > <!-- UAT Configuration --> > > <font metrics-url="/Arial.xml" kerning="yes" > > Is that your intention to have Arial.xml in the root of the Unix file > tree? Maybe that's your mistake? > > BTW, with FOP 0.95 you don't need to create XML font metrics files > anymore. You can simply do this: > > <font embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf"> > <font-triplet name="Arial" style="normal" weight="normal"/> > <font-triplet name="ArialMT" style="normal" weight="normal"/> > <font-triplet name="arial" style="normal" weight="normal"/> > </font> > > or even skip all the individual font registrations and use: > > <auto-detect/> > > as explained here: > http://xmlgraphics.apache.org/fop/0.95/fonts.html#custom > > > embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf"> > > <font-triplet name="Arial" style="normal" weight="normal"/> > > <font-triplet name="ArialMT" style="normal" weight="normal"/> > > <font-triplet name="arial" style="normal" weight="normal"/> > > </font> > > <font metrics-url="/ArialB.xml" kerning="yes" > > embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial-Bold.ttf"> > > <font-triplet name="Arial" style="normal" weight="bold"/> > > <font-triplet name="ArialMT" style="normal" weight="bold"/> > > <font-triplet name="arial" style="normal" weight="bold"/> > > </font> > > <auto-detect/> > > </fonts> > > > > *In XSL file* > > For Normal display > > <fo:block xsl:use-attribute-sets="Arial11" > > xmlns:st1="urn:schemas-microsoft-com:office:smarttags"> > > <fo:leader/> > > </fo:block> > > For Bold Display > > > > <fo:block xsl:use-attribute-sets="Arial11" > > font-weight="bold" > xmlns:st1="urn:schemas-microsoft-com:office:smarttags"> > > <fo:leader/> > > </fo:block> > > > > <xsl:attribute-set name="Arial11" > > > <xsl:attribute name="font-size">0.95em</xsl:attribute> > > <xsl:attribute name="font-family">Arial</xsl:attribute> > > <xsl:attribute name="display-align">center</xsl:attribute> > > <xsl:attribute name="language">EN-US</xsl:attribute> > > </xsl:attribute-set> > > * > > On Console* > > > > [2008-12-02 12:23:01,915] [pool-1-thread-12] ERROR > FopDocumentRenderSystem - > > javax.xml.transform.TransformerException: org.xml.sax.SAXException: > > Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root ( > > http://www.w3.org/1999/XSL/Format) > > Exception in thread "pool-1-thread-12" > > > com.marsh.itg.ddeepa.services.contract.bobject.exception.LogicExecutionException: > > org.xml.sax.SAXException: Mismatch: page-sequence ( > > http://www.w3.org/1999/XSL/Format) vs. root ( > > http://www.w3.org/1999/XSL/Format) > > at > > > com..blogic.document.utils.FopDocumentRenderSystem.renderDocument(FopDocumentRenderSystem.java:164) > > at > > > com..blogic.document.utils.RenderSystemDocumentRenderer$RenderSystemInputStreamProvider$1.run(RenderSystemDocumentRenderer.java:75) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > > at java.lang.Thread.run(Thread.java:595) > > For this error, the following FAQ entry might help: > http://xmlgraphics.apache.org/fop/faq.html#saxexception-mismatch > > > Metrics URL is created using the following command > > > > java -cp > > > ./fop-0.95-1.jar:./xmlgraphics-commons-1.3.1.jar:commons-logging-1.0.4.jar:./commons-io-1.3.1.jar > > org.apache.fop.fonts.apps.TTFReader -enc ansi > > /usr/openwin/lib/X11/fonts/TrueType/Arial.ttf Arial.xml > > > > I tried to generate the file using with and without the -enc option. On > > windows I found that only the file created with -enc works. Without the > > option I get font error when PDF is generated on Windows and only dots > > appear. > > Since you're on FOP 0.95 I'd really avoid TTFReader. It just makes the > stuff more complicated than necessary. > > > The autodetect feature loads all the fonts but substitute with "any" > before > > displaying. > > Some things to check: > - Are you sure that the configuration file has the right format (I've > only seen a snippet above)? > - And is the configuration file properly given to FOP? > - Do you have an older FOP still in the classpath? > > > Please help me with this issue. I have spent hours on it without any > > success. > > > > Thanks > > > > Regards > > Ashish Baijal > > BTW, for FOP-specific support it's a good idea to use the > FOP Users Mailing List: > http://xmlgraphics.apache.org/fop/maillist.html#fop-user > > HTH > > Best regards, > Jeremias Märki > _________________________________________________________ > Jeremias Märki, Software-Development and Consulting > Contact Information: http://www.jeremias-maerki.ch/contact.html > Blog: http://www.jeremias-maerki.ch/blog/ > > >
Received on Tuesday, 2 December 2008 20:22:13 UTC