Skip to content

Commit 8ea1a42

Browse files
authored
Merge pull request #528 from fugerit-org/527-chore-fj-doc-playground-quarkus-add-pdfua-1-rendering-option
527 chore fj doc playground quarkus add pdfua 1 rendering option
2 parents 7870ca5 + c3963ef commit 8ea1a42

File tree

6 files changed

+117
-1
lines changed

6 files changed

+117
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- fj-doc-playground-quarkus PDF/UA-1 rendering option' <https://github.com/fugerit-org/fj-doc/issues/527>
13+
1014
### Changed
1115

1216
- quarkus-version set to 3.28.2 across all the modules <https://github.com/fugerit-org/fj-doc/issues/525>

fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/InitPlayground.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,25 @@ public class InitPlayground {
1616

1717
public static final String OUTPUT_FORMAT_PDF_A = "pdfa";
1818

19+
public static final String OUTPUT_FORMAT_PDF_UA = "pdfua";
20+
1921
private static final FreemarkerDocProcessConfig PROCESS_CONFIG = FreemarkerDocProcessConfigFacade
2022
.loadConfigSafe("cl://playground-config/fm-playground-doc-process.xml");
2123

2224
public static final DocTypeHandler PDF_FOP_TYPE_HANDLER = PROCESS_CONFIG.getFacade().findHandler("pdf-fop");
2325

2426
public static final DocTypeHandler PDFA_FOP_TYPE_HANDLER = PROCESS_CONFIG.getFacade().findHandler("PDF/A-1a");
2527

28+
public static final DocTypeHandler PDFUA_FOP_TYPE_HANDLER = PROCESS_CONFIG.getFacade().findHandler("PDF/UA-1");
29+
2630
void onStart(@Observes StartupEvent ev) {
2731
log.info("InitPlayground start {}", ev);
2832
InitHandler.initDocAsync(PDF_FOP_TYPE_HANDLER);
2933
log.info("InitPlayground PDF_FOP_TYPE_HANDLER -> {}", PDF_FOP_TYPE_HANDLER);
34+
InitHandler.initDocAsync(PDFA_FOP_TYPE_HANDLER);
3035
log.info("InitPlayground PDFA_FOP_TYPE_HANDLER -> {}", PDFA_FOP_TYPE_HANDLER);
36+
InitHandler.initDocAsync(PDFUA_FOP_TYPE_HANDLER);
37+
log.info("InitPlayground PDFUA_FOP_TYPE_HANDLER -> {}", PDFUA_FOP_TYPE_HANDLER);
3138
log.info("InitPlayground end");
3239
}
3340

fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const DocXmlEditor = ({handleOpenDialog, setHelpContent}) => {
168168
if ( docFormat === 'HTML' ) {
169169
let decodedStringAtoB = atob(docOutput);
170170
outputData = <div contentEditable='true' dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(decodedStringAtoB) }}></div>
171-
} else if ( docFormat === 'PDF' || docFormat === 'PDFA' || docFormat === 'OPENPDF' ) {
171+
} else if ( docFormat === 'PDF' || docFormat === 'PDFA' || docFormat === 'PDFUA' || docFormat === 'OPENPDF' ) {
172172
let srcData = 'data:application/pdf;base64,'+ docOutput;
173173
outputData = <embed width="100%" height="600" src={srcData}/>
174174
} else if ( docFormat === 'XLSX' ) {
@@ -301,6 +301,7 @@ const DocXmlEditor = ({handleOpenDialog, setHelpContent}) => {
301301
<MenuItem value='HTML'>HTML</MenuItem>
302302
<MenuItem value='PDF'>PDF (fop)</MenuItem>
303303
<MenuItem value='PDFA'>PDF/A (fop)</MenuItem>
304+
<MenuItem value='PDFUA'>PDF/UA-1 (fop)</MenuItem>
304305
<MenuItem value='XLSX'>XLSX</MenuItem>
305306
<MenuItem value='MD'>Markdown (MD)</MenuItem>
306307
<MenuItem value='XML'>Venus XML Doc</MenuItem>

fj-doc-playground-quarkus/src/main/resources/playground-config/fm-playground-doc-process.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,50 @@
6161
</fop>
6262
</docHandlerCustomConfig>
6363
</docHandler>
64+
<docHandler id="pdfua" info="pdf" type="org.fugerit.java.doc.mod.fop.PdfFopTypeHandler">
65+
<docHandlerCustomConfig charset="UTF-8" fop-config-mode="inline" pdf-ua-mode="PDF/UA-1">
66+
<fop version="1.0">
67+
<!-- Strict user configuration -->
68+
<strict-configuration>true</strict-configuration>
69+
<!-- Strict FO validation -->
70+
<strict-validation>true</strict-validation>
71+
<!-- Base URL for resolving relative URLs -->
72+
<base>.</base>
73+
<!-- Font Base URL for resolving relative font URLs -->
74+
<font-base>.</font-base>
75+
<accessibility>
76+
<pdf-ua-mode>true</pdf-ua-mode>
77+
</accessibility>
78+
<renderers>
79+
<renderer mime="application/pdf">
80+
<!-- using recent PDF specs for better accessibility compliance -->
81+
<version>1.7</version>
82+
<fonts>
83+
<font embed-url="classpath://font/TitilliumWeb-Regular.ttf" embedding-mode="full">
84+
<font-triplet name="TitilliumWeb" style="normal" weight="normal"/>
85+
</font>
86+
<font embed-url="classpath://font/TitilliumWeb-Bold.ttf" embedding-mode="full">
87+
<font-triplet name="TitilliumWeb" style="normal" weight="bold"/>
88+
</font>
89+
<font embed-url="classpath://font/TitilliumWeb-Italic.ttf" embedding-mode="full">
90+
<font-triplet name="TitilliumWeb" style="italic" weight="normal"/>
91+
</font>
92+
<font embed-url="classpath://font/TitilliumWeb-BoldItalic.ttf" embedding-mode="full">
93+
<font-triplet name="TitilliumWeb" style="italic" weight="bold"/>
94+
</font>
95+
</fonts>
96+
</renderer>
97+
</renderers>
98+
<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
99+
<source-resolution>72</source-resolution>
100+
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
101+
<target-resolution>72</target-resolution>
102+
<!-- default page-height and page-width, in case
103+
value is specified as auto -->
104+
<default-page-settings height="11in" width="8.26in"/>
105+
</fop>
106+
</docHandlerCustomConfig>
107+
</docHandler>
64108
<docHandler id="md" info="md" type="org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandlerNoCommentsUTF8" />
65109
<docHandler id="xml" info="xml" type="org.fugerit.java.doc.base.typehandler.core.DocTypeHandlerCoreXMLUTF8" />
66110
<docHandler id="json" info="json" type="org.fugerit.java.doc.json.typehandler.DocTypeHandlerCoreJSONUTF8" />

fj-doc-sample/src/main/resources/sample_docs/doc_catalog.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
description="Sample fugerit kotlin document 1 with params"/>
3838
<doc id="kts-02" type="kts" path="playground/sample-2.kts" jsonDataPath="playground/data/kotlin.json"
3939
description="Sample fugerit kotlin document 2 with no params"/>
40+
<doc id="pdf-accessibility" type="xml" path="playground/pdf-accessibility.xml" description="Accessibility example with PDF/UA-1 profile active"/>
4041
</catalog>
4142

4243
</doc-catalog>

fj-doc-sample/src/main/resources/sample_docs/playground/pdf-accessibility.xml

Lines changed: 59 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)