Details
Description
When merging PDF's with the code:
PDFMergerUtility pm = new PDFMergerUtility();
File destPdf = File.createTempFile("TestFax_", ".pdf");
pm.setDestinationFileName(destPdf.getAbsolutePath());
for (File pdfFile:pdfFiles)
{ pm.addSource(pdfFile); }try
{ pm.mergeDocuments(); return PDDocument.load(destPdf); }catch (COSVisitorException e)
{ LoggerFactory.getLogger(getClass()).error("Merging PDF's", e); }I get the exception:
10:44:09.511 [Thread-6] ERROR midwifemate.client.ui.PrintDialog$7 - null
java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSObject
at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:438) [classes/:na]
at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:475) [classes/:na]
at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:433) [classes/:na]
at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:227) [classes/:na]
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:134) [classes/:na]
at com.selene.mm.model.fax.Fax.getPdfForFaxing(Fax.java:254) [classes/:na]
at com.selene.mm.model.fax.Fax.getPdfForPrinting(Fax.java:162) [classes/:na]
at midwifemate.client.ui.PrintDialog$7.run(PrintDialog.java:415) [classes/:na]
at midwifemate.ui.util.JProgressPane$1$1.run(JProgressPane.java:51) [classes/:na]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_10-rc2]
PDF's attached.
Attachments
Attachments
Issue Links
- duplicates
-
PDFBOX-724 ClassCastException when merging PDFs using PDFMergerUtility
- Closed