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:
Heavenfighter
2024-05-30 16:02:46 +02:00
parent ed0c12dfaa
commit 18be7adb07
3 changed files with 7 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
package org.mustangproject.ZUGFeRD;
import org.apache.fop.apps.*;
import org.apache.fop.apps.io.ResourceResolverFactory;
import org.apache.fop.configuration.Configuration;
import org.apache.fop.configuration.ConfigurationException;
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.getFontManager().setResourceResolver(
ResourceResolverFactory.createInternalResourceResolver(
new File(".").toURI(),
new ClasspathResolverURIAdapter()));
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");