allow embedd fonts from jar-file for pdf creation
fonts can now added in fop configuration via classpath notation. Also added FreeSans.ttf
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import org.apache.fop.apps.*;
|
import org.apache.fop.apps.*;
|
||||||
|
import org.apache.fop.apps.io.ResourceResolverFactory;
|
||||||
import org.apache.fop.configuration.Configuration;
|
import org.apache.fop.configuration.Configuration;
|
||||||
import org.apache.fop.configuration.ConfigurationException;
|
import org.apache.fop.configuration.ConfigurationException;
|
||||||
import org.apache.fop.configuration.DefaultConfigurationBuilder;
|
import org.apache.fop.configuration.DefaultConfigurationBuilder;
|
||||||
@@ -304,6 +305,11 @@ public class ZUGFeRDVisualizer {
|
|||||||
|
|
||||||
FopFactory fopFactory = builder.build();//FopFactory.newInstance(new File("c:\\Users\\jstaerk\\temp\\fop-config.xconf"));
|
FopFactory fopFactory = builder.build();//FopFactory.newInstance(new File("c:\\Users\\jstaerk\\temp\\fop-config.xconf"));
|
||||||
|
|
||||||
|
fopFactory.getFontManager().setResourceResolver(
|
||||||
|
ResourceResolverFactory.createInternalResourceResolver(
|
||||||
|
new File(".").toURI(),
|
||||||
|
new ClasspathResolverURIAdapter()));
|
||||||
|
|
||||||
FOUserAgent userAgent = fopFactory.newFOUserAgent();
|
FOUserAgent userAgent = fopFactory.newFOUserAgent();
|
||||||
|
|
||||||
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
|
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
|
||||||
|
|||||||
BIN
library/src/main/resources/FreeSans.ttf
Normal file
BIN
library/src/main/resources/FreeSans.ttf
Normal file
Binary file not shown.
@@ -25,7 +25,7 @@
|
|||||||
<renderer mime="application/pdf">
|
<renderer mime="application/pdf">
|
||||||
<fonts><!-- https://xmlgraphics.apache.org/fop/1.1/fonts.html auto-embed -->
|
<fonts><!-- https://xmlgraphics.apache.org/fop/1.1/fonts.html auto-embed -->
|
||||||
<auto-detect/>
|
<auto-detect/>
|
||||||
<font kerning="no" embed-url="FreeSans.ttf" embedding-mode="subset">
|
<font kerning="no" embed-url="classpath:FreeSans.ttf" embedding-mode="subset">
|
||||||
<font-triplet name="SourceSerifPro" style="normal" weight="normal" />
|
<font-triplet name="SourceSerifPro" style="normal" weight="normal" />
|
||||||
<font-triplet name="Times-Bold" style="normal" weight="normal" />
|
<font-triplet name="Times-Bold" style="normal" weight="normal" />
|
||||||
</font>
|
</font>
|
||||||
|
|||||||
Reference in New Issue
Block a user