Réf. : Re: Réf. : Re: fonts on server

Hello

I'm building a class to output a dynamic PDF on a web site.

I use the userconfig.xml file and I add fonts on a server. I put the physic
pathes like that :
<fonts>
 <font metrics-file="/soft/server/font/arialuni.xml" kerning="yes"
embed-file="/soft/server/font/arialuni.ttf">
    <font-triplet name="Arial Unicode" style="normal" weight="normal"/>
    <font-triplet name="Arial Unicode" style="normal" weight="bold"/>
 </font>
</fonts>

Since I'm using a servlet I should call:
File userConfigFile = new File("/soft/server/font/userConfig.xml");
Options options = new Options(userConfigFile);

String xsl = "/soft/server/seePDF";
Source xmlsource = new StreamSource(new StringReader(xmlDocument));
res.setContentType("application/pdf");
Driver driver =new Driver();
driver.setOutputStream(res.getOutputStream());
driver.setRenderer(Driver.RENDER_PDF);
Transformer transformer=TransformerFactory.newInstance().newTransformer(new
StreamSource(xsl));
String codeLangue="gr" // Greek
transformer.setParameter("languedoc", codeLangue);
transformer.transform(xmlsource, new SAXResult(driver.getContentHandler
()));

When I run the servlet, all the files are found. I got no error message
about my new font but I got this java stack :

org.apache.fop.apps.FOPException
        at org.apache.fop.apps.Driver.render(Driver.java:486)
        at org.apache.fop.apps.Driver.run(Driver.java:554)
        at ae1.outils.XSLTUtil.FOPDFTransform(XSLTUtil.java:193)
        at ae1.outils.XSLTUtil.FOPDFTransformForServlet(XSLTUtil.java:224)
        at
ae1.servlets.VisualiserProduction.doPost(VisualiserProduction.java:154)
        at
ae1.servlets.VisualiserProduction.doGet(VisualiserProduction.java:32)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)

---------

java.lang.ArrayIndexOutOfBoundsException
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:878)
        at org.apache.fop.apps.Driver.render(Driver.java:481)
        at org.apache.fop.apps.Driver.run(Driver.java:554)
        at ae1.outils.XSLTUtil.FOPDFTransform(XSLTUtil.java:193)
        at ae1.outils.XSLTUtil.FOPDFTransformForServlet(XSLTUtil.java:224)
        at
ae1.servlets.VisualiserProduction.doPost(VisualiserProduction.java:154)
        at
ae1.servlets.VisualiserProduction.doGet(VisualiserProduction.java:32)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)

---------

java.lang.ArrayIndexOutOfBoundsException
        at
org.apache.fop.fonts.TTFSubSetFile.scanGlyphs(TTFSubSetFile.java:522)
        at
org.apache.fop.fonts.TTFSubSetFile.readFont(TTFSubSetFile.java:593)
        at
org.apache.fop.render.pdf.fonts.MultiByteFont.getFontFile(MultiByteFont.java:200)
        at
org.apache.fop.render.pdf.fonts.LazyFont.getFontFile(LazyFont.java:173)
        at
org.apache.fop.pdf.PDFDocument.makeFontDescriptor(PDFDocument.java:898)
        at org.apache.fop.pdf.PDFDocument.makeFont(PDFDocument.java:799)
        at
org.apache.fop.render.pdf.FontSetup.addToResources(FontSetup.java:206)
        at
org.apache.fop.render.pdf.PDFRenderer.stopRenderer(PDFRenderer.java:157)
        at
org.apache.fop.apps.StreamRenderer.stopRenderer(StreamRenderer.java:144)
        at
org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:205)
        at
org.apache.xerces.parsers.SAXParser.endDocument(SAXParser.java:1225)
        at
org.apache.xerces.validators.common.XMLValidator.callEndDocument(XMLValidator.java:629)
        at
org.apache.xerces.framework.XMLDocumentScanner$EndOfInputDispatcher.dispatch(XMLDocumentScanner.java:1545)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
        at org.apache.fop.apps.Driver.render(Driver.java:481)
        at org.apache.fop.apps.Driver.run(Driver.java:554)
        at ae1.outils.XSLTUtil.FOPDFTransform(XSLTUtil.java:193)
        at ae1.outils.XSLTUtil.FOPDFTransformForServlet(XSLTUtil.java:224)
        at
ae1.servlets.VisualiserProduction.doPost(VisualiserProduction.java:154)
        at
ae1.servlets.VisualiserProduction.doGet(VisualiserProduction.java:32)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)

Any help would be appreciated.
Thanks.

S. Peyronny

Received on Wednesday, 5 February 2003 08:29:14 UTC