2016-08-12 12 views
0

私の言語ではいくつかの特殊文字があるため、PDFファイルにフォントを埋め込む必要があります。私は、FOPに関するページをたくさん読んで、私はこのような設定ファイルを必要と考え出し:Maven pdf plugin:どこに配置するのですか?userconfig.xml

生憎
<?xml version="1.0"?> 
<fop> 
    <renderers> 
    <renderer mime="application/pdf">  
     <fonts>       
      <font kerning="yes" embed-url="file:///C:/windows/fonts/arial.ttf"> 
        <font-triplet name="Arial" style="normal" weight="normal"/> 
       </font>      
     </fonts> 
    </renderer> 
    </renderers>  
</fop> 

、私はMVN PDF実行するとPDFファイル-Xを、私はライン

[DEBUG] userconfig is null 

見ますconfigがロードされたように見えます。どこに設定ファイルを置くべきですか、どのように私はpdfプラグインを見てどこに見えるのですか?

答えて

1

私は解決策を見つけましたが、それでも理想的だとは確信していません。私はExec Maven Pluginを使い、Maven Pdf Pluginから作成した結果を使ってfopを実行します。

のpom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>cz.kosina</groupId> 
    <artifactId>pdf-generate</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 
    <name>PDF generation</name> 
    <repositories /> 
    <build> 
     <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-pdf-plugin</artifactId> 
      <version>1.3</version> 
      <configuration> 
       <locales>cs_CZ</locales> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.2.1</version> 
      <configuration> 
       <mainClass>org.apache.fop.cli.Main</mainClass> 
       <arguments> 
        <argument>-fo</argument> 
        <argument>.\target\pdf\maven-pdf-plugin.fo</argument> 
        <argument>-c</argument> 
        <argument>.\target\pdf\fop.xconf</argument> 
        <argument>file.pdf</argument> 
       </arguments> 
      </configuration> 
     </plugin> 
     </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
     <groupId>org.apache.xmlgraphics</groupId> 
     <artifactId>fop</artifactId> 
     <version>2.1</version> 
     </dependency> 
    </dependencies> 
</project> 

fop.xconf:

<?xml version="1.0" encoding="UTF-8"?> 
<fop> 
    <renderers> 
     <renderer mime="application/pdf"> 
     <fonts> 
      <font kerning="yes" embed-url="file:///C:/windows/fonts/arial.ttf"> 
       <font-triplet name="Arial" style="normal" weight="normal" /> 
      </font> 
     </fonts> 
     </renderer> 
    </renderers> 
</fop> 

fop.xconfは、PDF-config.xmlの隣にサイト/リソースに格納され、それが最終的な解決策は次のようになりますmaven pdfプラグインでターゲットにコピーしました。

関連する問題