Author: tilman
Date: Mon May 26 09:33:51 2025
New Revision: 1925814

URL: http://svn.apache.org/viewvc?rev=1925814&view=rev
Log:
PDFBOX-6009: early deletion of MCR/OBJR dictionaries with no /Pg entry because 
source had the wrong /Pg entry

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=1925814&r1=1925813&r2=1925814&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
 Mon May 26 09:33:51 2025
@@ -421,6 +421,7 @@ public class Splitter
             COSDictionary srcPageDict = srcDict.getCOSDictionary(COSName.PG);
             COSDictionary dstPageDict = null;
             COSBase kid = srcDict.getDictionaryObject(COSName.K);
+            COSName type = srcDict.getCOSName(COSName.TYPE);
             if (srcPageDict != null)
             {
                 dstPageDict = pageDictMap.get(srcPageDict);
@@ -434,8 +435,10 @@ public class Splitter
                 }
                 else
                 {
-                    // PDFBOX-6009: quit if MCIDs because these need a /Pg 
entry
-                    if (hasMCIDs(kid))
+                    // PDFBOX-6009: "wrong" /Pg entry
+                    // quit if MCIDs because these need a /Pg entry
+                    // or if MCR/OBJR dicts
+                    if (COSName.MCR.equals(type) || COSName.OBJR.equals(type) 
|| hasMCIDs(kid))
                     {
                         return null;
                     }
@@ -444,7 +447,6 @@ 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)
             {


Reply via email to