Skip to content

Commit 704f950

Browse files
committed
fix: fj-doc-mod-fop, fix doc-creator and doc-producer handling #563
1 parent 377ddb2 commit 704f950

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

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

1212
- fj-doc-mod-fop, new mod-fop-xslt-debug property <https://github.com/fugerit-org/fj-doc/issues/560>
1313

14+
### Fixed
15+
16+
- fj-doc-mod-fop, fix doc-creator and doc-producer handling <https://github.com/fugerit-org/fj-doc/issues/563>
17+
1418
## [8.17.1] - 2025-10-28
1519

1620
### Added

fj-doc-guide/src/main/docs/asciidoc/chapters/00_2_release_notes.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Whereas the link:https://github.com/fugerit-org/fj-doc/blob/main/CHANGELOG.md[CH
77
==== Unreleased
88

99
- fj-doc-mod-fop, new mod-fop-xslt-debug property link:https://github.com/fugerit-org/fj-doc/issues/560[#560]
10+
- fj-doc-mod-fop, fix doc-creator and doc-producer handling link:https://github.com/fugerit-org/fj-doc/issues/563[#563]
1011
1112
[#doc-release-notes-8-17-1]
1213
==== Version 8.17.1 [2025-10-28]

fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/PdfFopTypeHandler.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ private FopConfigWrap newFopWrap() throws ConfigException {
185185
}
186186
foUserAgent.setAccessibility( this.isAccessibility() );
187187
foUserAgent.setKeepEmptyTags( this.isKeepEmptyTags() );
188-
foUserAgent.setProducer( PRODUCER_DEFAULT );
189-
foUserAgent.setCreator( VenusVersion.VENUS_CREATOR );
190188
return new FopConfigWrap( fopFactory, foUserAgent );
191189
}
192190

@@ -226,6 +224,11 @@ private void xsltDebugCheck( DocBase docBase, byte[] xslContent, Transformer tra
226224
}
227225
}
228226

227+
private void setupMetadata( DocBase docBase, FOUserAgent foUserAgent ) {
228+
foUserAgent.setProducer( StringUtils.valueWithDefault( docBase.getInfoDocProducer(), PRODUCER_DEFAULT ) );
229+
foUserAgent.setCreator( StringUtils.valueWithDefault( docBase.getInfoDocCreator(), VenusVersion.VENUS_CREATOR ) );
230+
}
231+
229232
@SuppressWarnings("unchecked")
230233
@Override
231234
public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
@@ -235,7 +238,9 @@ public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
235238
// the XML file which provides the input
236239
StreamSource xmlSource = new StreamSource( new InputStreamReader( input, this.getCharset() ) );
237240
FopConfigWrap fopWrap = this.fopWrapSupplier.get();
238-
Fop fop = fopWrap.getFopFactory().newFop(MimeConstants.MIME_PDF, fopWrap.getFoUserAgent(), docOutput.getOs());
241+
FOUserAgent foUserAgent = fopWrap.getFoUserAgent();
242+
this.setupMetadata( docBase, foUserAgent);
243+
Fop fop = fopWrap.getFopFactory().newFop(MimeConstants.MIME_PDF, foUserAgent, docOutput.getOs());
239244
TransformerFactory factory = TransformerXML.newSafeTransformerFactory();
240245
Transformer transformer = this.newTransformer( factory, docBase );
241246
this.xsltDebugCheck( docBase, xslContent, transformer );

fj-doc-mod-fop/src/test/resources/sample/doc_producer.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<info name="doc-title">Apache FOP doc-producer</info>
88
<info name="doc-subject">Integration test for doc-producer info attribure</info>
99
<info name="doc-author">fugerit79</info>
10-
<info name="doc-creator">My Creator</info>
10+
<info name="doc-creator">My Creator</info>
11+
<info name="doc-producer">My Producer</info>
1112
<footer-ext>
1213
<para align="center">Page ${currentPage}</para>
1314
</footer-ext>

0 commit comments

Comments
 (0)