diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt index 7c5c3e74a..a34f472d3 100644 --- a/docgen/release-notes.txt +++ b/docgen/release-notes.txt @@ -1,4 +1,8 @@ -1.4.0-rc.001 (2023-07-29) +1.X.X-rc.001 (2023-XX-XX) +------------------ ++ Added PDFA output format in playground + +1.4.0-rc.001 (2023-07-29) ------------------ + [Added native support for GraalVM in core modules (fj-doc-base and fj-doc-freemarker)](https://github.com/fugerit-org/fj-doc/issues/39) + [[fj-doc-mod-fop] support for last page constant ${pageCount}](https://github.com/fugerit-org/fj-doc/issues/47) diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java index abfabd2f0..4193714ed 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java @@ -98,6 +98,7 @@ private static DocTypeHandler createHelper( Element docHandlerConfig ) throws Co } public static FreemarkerDocProcessConfig loadConfigSafe( String configPath ) { + log.info( "loadConfigSafe config path : {}", configPath ); FreemarkerDocProcessConfig config = null; try ( Reader xmlReader = new InputStreamReader(StreamHelper.resolveStream( configPath ) ) ) { config = loadConfig(xmlReader); diff --git a/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/config/InitPlayground.java b/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/config/InitPlayground.java index da335018b..188b08d46 100644 --- a/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/config/InitPlayground.java +++ b/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/config/InitPlayground.java @@ -1,7 +1,9 @@ package org.fugerit.java.doc.playground.config; +import org.fugerit.java.doc.base.config.DocTypeHandler; import org.fugerit.java.doc.base.config.InitHandler; -import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler; +import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig; +import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade; import io.quarkus.runtime.StartupEvent; import jakarta.enterprise.context.ApplicationScoped; @@ -11,12 +13,18 @@ @Slf4j @ApplicationScoped public class InitPlayground { - - public static final PdfFopTypeHandler PDF_FOP_TYPE_HANDLER = new PdfFopTypeHandler(); - void onStart(@Observes StartupEvent ev) { + private static final FreemarkerDocProcessConfig PROCESS_CONFIG = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://playground-config/fm-playground-doc-process.xml" ); + + public static final DocTypeHandler PDF_FOP_TYPE_HANDLER = PROCESS_CONFIG.getFacade().findHandler( "pdf-fop" ); + + public static final DocTypeHandler PDFA_FOP_TYPE_HANDLER = PROCESS_CONFIG.getFacade().findHandler( "PDF/A-1a" ); + + void onStart(@Observes StartupEvent ev) { log.info( "InitPlayground start" ); InitHandler.initDocAsync( PDF_FOP_TYPE_HANDLER ); + log.info( "InitPlayground PDF_FOP_TYPE_HANDLER -> {}", PDF_FOP_TYPE_HANDLER ); + log.info( "InitPlayground PDFA_FOP_TYPE_HANDLER -> {}", PDFA_FOP_TYPE_HANDLER ); log.info( "InitPlayground end" ); } diff --git a/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateRest.java b/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateRest.java index 8fda5b5a3..fca114998 100644 --- a/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateRest.java +++ b/fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateRest.java @@ -64,6 +64,8 @@ private DocTypeHandler findHandler( BasicInput input ) { handler = XlsxPoiTypeHandler.HANDLER; } else if ( "HTML".equalsIgnoreCase( input.getOutputFormat() ) ) { handler = FreeMarkerHtmlFragmentTypeHandler.HANDLER; + } else if ( "PDFA".equalsIgnoreCase( input.getOutputFormat() ) ) { + handler = InitPlayground.PDFA_FOP_TYPE_HANDLER; } return handler; } diff --git a/fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx b/fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx index 14e268bb9..adc21c1b5 100644 --- a/fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx +++ b/fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx @@ -118,7 +118,7 @@ class DocXmlEditor extends Component { if ( this.state.docFormat === 'HTML' ) { var decodedStringAtoB = atob(this.state.docOutput); outputData =
- } else if ( this.state.docFormat === 'PDF' ) { + } else if ( this.state.docFormat === 'PDF' || this.state.docFormat === 'PDFA' ) { let srcData = 'data:application/pdf;base64,'+ this.state.docOutput; outputData = outputData =