Author: tilman
Date: Sat May 24 15:21:44 2025
New Revision: 1925785
URL: http://svn.apache.org/viewvc?rev=1925785&view=rev
Log:
PDFBOX-6009: drop OBJR and MCR dictionaries if no /Pg entry in itself or in
parent
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java?rev=1925785&r1=1925784&r2=1925785&view=diff
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
(original)
+++
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
Sat May 24 15:21:44 2025
@@ -442,6 +442,15 @@ public class Splitter
}
}
+ // special handling for MCR items ("marked-content reference
dictionary")
+ COSName type = srcDict.getCOSName(COSName.TYPE);
+ if (COSName.MCR.equals(type) && dstPageDict == null &&
+ dstParent instanceof COSDictionary && ((COSDictionary)
dstParent).getCOSDictionary(COSName.PG) == null)
+ {
+ // PAC: Pg entry of marked-content reference and of parent
structure is null
+ return null;
+ }
+
// Create and fill clone
dstDict = new COSDictionary();
structDictMap.put(srcDict, dstDict);
@@ -458,7 +467,6 @@ public class Splitter
// special handling for OBJR items ("object reference dictionary")
// see e.g. file 488300.pdf and
Root/StructTreeRoot/K/K/[2]/K/[1]/K/[0]/Obj
- COSName type = srcDict.getCOSName(COSName.TYPE);
if (COSName.OBJR.equals(type))
{
COSDictionary srcObj = srcDict.getCOSDictionary(COSName.OBJ);
@@ -476,6 +484,12 @@ public class Splitter
{
return null;
}
+ if (dstPageDict == null &&
+ dstParent instanceof COSDictionary && ((COSDictionary)
dstParent).getCOSDictionary(COSName.PG) == null)
+ {
+ // Pg entry of object reference dictionary and of parent
structure is null
+ return null;
+ }
}
else
{