AnsweredAssumed Answered

erreur de chargement fond True Type avec API PDFbox [Résolu]

Question asked by huberd on Apr 11, 2008
Latest reply on Jun 3, 2008 by huberd
Bonjour,

Je cherche à utiliser une police True Type (Thaoma) via l'API PDFBox. Pour cela j'ai rajouté les polices Tahoma.ttf et Tahoma-Bold.ttf dans le repertoire Resources/ttf du fichier JAR pdfbox-0.7.3 et j'ai également modifié comme suit le fichier PDFBox_External_Fonts.properties situé dans le repertoire Resources/ttf comme indiqué sur le site de PDFBox : http://www.pdfbox.org/userguide/fonts.html#External+TrueType+Fonts.

PDFBox_External_Fonts.properties
Arial-BoldItalicMT=Resources/ttf/Arial-BoldItalicMT.ttf
Arial-BoldMT=Resources/ttf/Arial-BoldMT.ttf
ArialMT=Resources/ttf/ArialMT.ttf
Tahoma=Resources/ttf/Tahoma.ttf
Tahoma-Bold=Resources/ttf/Tahoma-Bold.ttf
UNKNOWN_FONT=Resources/ttf/ArialMT.ttf

Pour charger ma police, j'utilise le code suivant:

PDFont font = PDTrueTypeFont.loadTTF(pdf, new File( "Tahoma.ttf"));

mais j'obtiens l'erreur suivante :

java.io.FileNotFoundException: Tahoma.ttf (Le fichier spécifié est introuvable)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(Unknown Source)
   at org.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:155)
   at org.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:140)
   at lpr.alfresco.repo.workflow.jbpm.PublishedDocument.addReference(PublishedDocument.java:416)
   at lpr.alfresco.repo.workflow.jbpm.PublishedDocument.execute(PublishedDocument.java:297)
   at org.jbpm.graph.def.Action.execute(Action.java:122)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:247)
   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
   at org.jbpm.graph.def.Node.leave(Node.java:381)
   at org.jbpm.graph.node.StartState.leave(StartState.java:70)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$4469a162.leave(<generated>)
   at org.jbpm.graph.exe.Token.signal(Token.java:194)
   at org.jbpm.graph.exe.Token.signal(Token.java:139)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:475)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:126)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:389)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$25.doInJbpm(JBPMEngine.java:1512)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1489)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:444)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   at $Proxy43.endTask(Unknown Source)
   at org.alfresco.web.bean.workflow.StartWorkflowWizard.finishImpl(StartWorkflowWizard.java:197)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:118)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:115)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:225)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:124)
   at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:520)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.alfresco.web.app.servlet.NTLMAuthenticationFilter.doFilter(NTLMAuthenticationFilter.java:329)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
   at java.lang.Thread.run(Unknown Source)

Si quelqu'un à une idée, je vous en remercie d'avance.

Outcomes