Robert Fink created PDFBOX-4968:
-----------------------------------
Summary: PDImageXObject and UnsupportedOperationException combined
with JPEGFactory
Key: PDFBOX-4968
URL: https://issues.apache.org/jira/browse/PDFBOX-4968
Project: PDFBox
Issue Type: Bug
Components: PDModel, XmpBox
Affects Versions: 2.0.0
Environment: Windows 10 (64 Bit), Java 11.0.8, Netbeans 11.2
Reporter: Robert Fink
Attachments: SampleApplication.java
The goal is to add Metadata to an image within the PDF document.
The PDImageXObject is created by the JPEGFactory class and the method
createFromImage(pdDocument, bufferedImage).
The PDImageXObject itself will be created but when trying to add metadata to it
an error is thrown. Catching the UnsupportedOperationException would work.
It doesn't work with Java 8 and Java 11 starting from PDFBox 2.0.0.
{code:java}
// Output
Sep. 25, 2020 3:21:49 NACHM. sample.application.SampleApplication
addMetadataToImage
SCHWERWIEGEND: null
java.lang.UnsupportedOperationException: DCTFilter encoding not implemented,
use the JPEGFactory methods instead
at org.apache.pdfbox.filter.DCTFilter.encode(DCTFilter.java:371)
at org.apache.pdfbox.filter.Filter.encode(Filter.java:101)
at org.apache.pdfbox.cos.COSOutputStream.close(COSOutputStream.java:93)
at
java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:188)
at org.apache.pdfbox.cos.COSStream$1.close(COSStream.java:236)
at
org.apache.pdfbox.pdmodel.common.PDMetadata.importXMPMetadata(PDMetadata.java:99)
at
sample.application.SampleApplication.addMetadataToImage(SampleApplication.java:63)
at
sample.application.SampleApplication.main(SampleApplication.java:55){code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]