pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Zimmermann (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4400) jlink loading police.afm files
Date Wed, 12 Dec 2018 13:35:00 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-4400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16718973#comment-16718973
] 

Thomas Zimmermann commented on PDFBOX-4400:
-------------------------------------------

I'm also using the [moditect-maven-plugin|https://github.com/moditect/moditect] to generate
module descriptors for pdfbox, fontbox, xmpbox and JAXB (javax.activation-api lacks a module
descriptor). I'll append my configuration, maybe you are doing something different, [~yboompook].

 

To verify the fix worked, I did:
{noformat}
git clone https://github.com/apache/pdfbox.git{noformat}
then inside the pdfbox directory

 
{noformat}
mvn clean install{noformat}
and then changed my project to depend on pdfbox version 3.0.0-SNAPSHOT.

 

 

Here is the relevant part of the configuration for the moditect-maven-plugin (this is for
the 3.0.0-SNAPSHOT version of pdfbox, fontbox added a package recently, so that also needs
to be exported):

 
{code:java}
<module>
    <artifact>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
    </artifact>
    <moduleInfoSource>
        module pdfbox {
        requires static org.bouncycastle.pkix;
        requires static org.bouncycastle.provider;

        requires transitive java.desktop;
        requires transitive java.xml;
        requires transitive fontbox;
        requires transitive org.apache.commons.logging;

        exports org.apache.pdfbox.contentstream;
        exports org.apache.pdfbox.contentstream.operator;
        exports org.apache.pdfbox.contentstream.operator.color;
        exports org.apache.pdfbox.contentstream.operator.graphics;
        exports org.apache.pdfbox.contentstream.operator.markedcontent;
        exports org.apache.pdfbox.contentstream.operator.state;
        exports org.apache.pdfbox.contentstream.operator.text;
        exports org.apache.pdfbox.cos;
        exports org.apache.pdfbox.filter;
        exports org.apache.pdfbox.io;
        exports org.apache.pdfbox.multipdf;
        exports org.apache.pdfbox.pdfparser;
        exports org.apache.pdfbox.pdfwriter;
        exports org.apache.pdfbox.pdmodel;
        exports org.apache.pdfbox.pdmodel.common;
        exports org.apache.pdfbox.pdmodel.common.filespecification;
        exports org.apache.pdfbox.pdmodel.common.function;
        exports org.apache.pdfbox.pdmodel.common.function.type4;
        exports org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure;
        exports org.apache.pdfbox.pdmodel.documentinterchange.markedcontent;
        exports org.apache.pdfbox.pdmodel.documentinterchange.prepress;
        exports org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
        exports org.apache.pdfbox.pdmodel.encryption;
        exports org.apache.pdfbox.pdmodel.fdf;
        exports org.apache.pdfbox.pdmodel.font;
        exports org.apache.pdfbox.pdmodel.font.encoding;
        exports org.apache.pdfbox.pdmodel.graphics;
        exports org.apache.pdfbox.pdmodel.graphics.blend;
        exports org.apache.pdfbox.pdmodel.graphics.color;
        exports org.apache.pdfbox.pdmodel.graphics.form;
        exports org.apache.pdfbox.pdmodel.graphics.image;
        exports org.apache.pdfbox.pdmodel.graphics.optionalcontent;
        exports org.apache.pdfbox.pdmodel.graphics.pattern;
        exports org.apache.pdfbox.pdmodel.graphics.shading;
        exports org.apache.pdfbox.pdmodel.graphics.state;
        exports org.apache.pdfbox.pdmodel.interactive.action;
        exports org.apache.pdfbox.pdmodel.interactive.annotation;
        exports org.apache.pdfbox.pdmodel.interactive.annotation.handlers;
        exports org.apache.pdfbox.pdmodel.interactive.annotation.layout;
        exports org.apache.pdfbox.pdmodel.interactive.digitalsignature;
        exports org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible;
        exports org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination;
        exports org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline;
        exports org.apache.pdfbox.pdmodel.interactive.form;
        exports org.apache.pdfbox.pdmodel.interactive.measurement;
        exports org.apache.pdfbox.pdmodel.interactive.pagenavigation;
        exports org.apache.pdfbox.pdmodel.interactive.viewerpreferences;
        exports org.apache.pdfbox.printing;
        exports org.apache.pdfbox.rendering;
        exports org.apache.pdfbox.text;
        exports org.apache.pdfbox.util;
        exports org.apache.pdfbox.util.filetypedetector;
        }
    </moduleInfoSource>
</module>
<module>
    <artifact>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>fontbox</artifactId>
    </artifact>
    <moduleInfoSource>
        module fontbox {
        requires org.apache.commons.logging;
        requires transitive java.desktop;

        exports org.apache.fontbox;
        exports org.apache.fontbox.afm;
        exports org.apache.fontbox.cff;
        exports org.apache.fontbox.cmap;
        exports org.apache.fontbox.encoding;
        exports org.apache.fontbox.pfb;
        exports org.apache.fontbox.ttf;
        exports org.apache.fontbox.ttf.gsub;
        exports org.apache.fontbox.ttf.model;
        exports org.apache.fontbox.ttf.table.common;
        exports org.apache.fontbox.ttf.table.gsub;
        exports org.apache.fontbox.type1;
        exports org.apache.fontbox.util;
        exports org.apache.fontbox.util.autodetect;
        }
    </moduleInfoSource>
</module>
<module>
    <artifact>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>xmpbox</artifactId>
    </artifact>
    <moduleInfoSource>
        module xmpbox {
        requires java.xml.bind;
        requires transitive java.xml;

        exports org.apache.xmpbox;
        exports org.apache.xmpbox.schema;
        exports org.apache.xmpbox.type;
        exports org.apache.xmpbox.xml;
        }
    </moduleInfoSource>
</module>
<!--
javax:activation:javax.activation-api:1.2.0 is
using removed JDK classes, but it still works somehow:
https://github.com/eclipse-ee4j/jaxb-ri/issues/1236

Remove this when JAXB is using a version that has a
proper module-info.java.
-->
<module>
    <artifact>
        <groupId>javax.activation</groupId>
        <artifactId>javax.activation-api</artifactId>
    </artifact>
    <moduleInfoSource>
        module java.activation {
        requires java.logging;
        requires transitive java.datatransfer;
        requires transitive java.desktop;

        exports javax.activation;
        }
    </moduleInfoSource>
</module>
{code}
 

 

> jlink loading police.afm files
> ------------------------------
>
>                 Key: PDFBOX-4400
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4400
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.13
>         Environment: java11 jlink windows moditect
>            Reporter: kevin guerin
>            Assignee: Tilman Hausherr
>            Priority: Major
>              Labels: jdk9
>             Fix For: 2.0.14, 3.0.0 PDFBox
>
>
> hello everybody,
>  
> I've got a problem with this trace on jlink on java11 (it works without jlink)
>  
> {code:java}
> // Exception in thread "JavaFX Application Thread" java.lang.ExceptionInInitializerError
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:112)
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:176)
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:83)
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146)
>         at pdfbox@2.0.13/org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
>         at pdfbox@2.0.13/org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
>         at pdfbox@2.0.13/org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
>         at pdfbox@2.0.13/org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
>         at pdfbox@2.0.13/org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
>         at pdfbox@2.0.13/org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:254)
>         at pdfbox@2.0.13/org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:245)
>         at pdfbox@2.0.13/org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:179)
>       
> Caused by: java.lang.RuntimeException: java.io.IOException: org/apache/pdfbox/resources/afm/Courier-Bold.afm
not found
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.Standard14Fonts.<clinit>(Standard14Fonts.java:97)
>         ... 36 more
> Caused by: java.io.IOException: org/apache/pdfbox/resources/afm/Courier-Bold.afm not
found
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.Standard14Fonts.addAFM(Standard14Fonts.java:134)
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.Standard14Fonts.addAFM(Standard14Fonts.java:103)
>         at pdfbox@2.0.13/org.apache.pdfbox.pdmodel.font.Standard14Fonts.<clinit>(Standard14Fonts.java:50)
>         ... 36 more
> {code}
>  
> I think the problem comes from the fact that while using jlink the classpath does not
exist and it need to be loaded by an another way that the classpath one.
>  
> the path should look like something like :
> {code:java}
> // Path path = Paths.get(URI.create("jrt:/pdfbox/org/apache/resources/afm/police.afm"));
> {code}
> modules here is managed by moditect (maven plugin to help creating module-info descriptor)
and contain all dependancies of the project



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message