Author: tilman
Date: Sat May 24 15:21:40 2025
New Revision: 1925784
URL: http://svn.apache.org/viewvc?rev=1925784&view=rev
Log:
PDFBOX-6009: drop OBJR and MCR dictionaries if no /Pg entry in itself or in
parent
Modified:
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
Modified:
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java?rev=1925784&r1=1925783&r2=1925784&view=diff
==============================================================================
---
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
(original)
+++
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
Sat May 24 15:21:40 2025
@@ -440,6 +440,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);
@@ -456,7 +465,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);
@@ -474,6 +482,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
{