Please retry with the 3.0.1 snapshot, there were bugs fixed related to combining files. If there bug is still there please create a ticket in JIRA

Tilman

On 21.11.2023 19:56, John Lussmyer wrote:
I'm using PDFBox 3.0.0 to combine some PDF files.  One of the files uses an Optional Content Group. Note that this code has been working just fine for many other files both with and without OCG's.

For this file, I get this exception:

java.lang.IllegalArgumentException: Provided dictionary is not of type 'COSName{OCG}'

    at org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentGroup.<init>(PDOptionalContentGroup.java:48) ~[pdfbox-3.0.0.jar:3.0.0]

Code:

*if*(obj*instanceof*COSDictionary) {

COSDictionary dict= (COSDictionary) obj;

COSName dType= dict.getCOSName(COSName.*/TYPE/*);

*if*(dType== *null*) {

*continue*;

}

*if*(dType.equals(COSName.*/OCG/*)) {

*/log/*.debug("addOCGs: OCG {}", dict);

PDOptionalContentGroup grp= *new*PDOptionalContentGroup(dict);

ocProps.addGroup(grp);

ocProps.setGroupEnabled(grp, layersON.contains(grp.getName()));

changed= *true*;

}

}

 It's failing on the "new PDOptionalContentGroup(dict)" call.
Any ideas on why?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to