PDF conversion operations - Failed to invoke operation Blob.ConcatenatePDFs - Missing root object specification in trailer - [SOLVED]

Hi,

When I try to merge some PDFs to have one document with nuxeo operation Blob.ConcatenatePDFs, I always have this exception :

Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Blob.ConcatenatePDFs
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:190) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:147) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.lambda$invoke$0(OperationChainCompiler.java:212) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.OperationContext.call(OperationContext.java:331) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.OperationContext.callWithChainParameters(OperationContext.java:296) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.invoke(OperationChainCompiler.java:209) ~[nuxeo-automation-core-2021.43.7.jar:?]
...
Caused by: java.io.IOException: Missing root object specification in trailer.
        at org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2865) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:175) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:226) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1228) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1146) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.multipdf.PDFMergerUtility.legacyMergeDocuments(PDFMergerUtility.java:455) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:346) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:330) ~[pdfbox-2.0.24.jar:2.0.24]
        at org.nuxeo.ecm.automation.core.operations.blob.ConcatenatePDFs.appendPDFs(ConcatenatePDFs.java:86) ~[nuxeo-automation-core-2021.43.7.jar:?]
        at org.nuxeo.ecm.automation.core.operations.blob.ConcatenatePDFs.run(ConcatenatePDFs.java:80) ~[nuxeo-automation-core-2021.43.7.jar:?]

I read on apache issue , it seams like it's dued by early closing when writing the merged file like here (I was writing files and I didnt wait for them to close, therefore the jar had problems in merging them. ).

How can can avoid closing files before the merge finished ?

Thanks for help

0 votes

1 answers

699 views

ANSWER



Hi,

I found where this issue come from. It comes from a corruped document in the list of documents to concatenate. So, I deleted the document, excute the operation (after restart nuxeo) again and it works.

The problem is, when the nuxeo instance generate the esxception at the first time, we are not able to concatenate another list of document even if all documents are good. We have to restart nuxeo, to make it works again.

Thanks

0 votes