private boolean hasBlendMode(PDPage page) { // check the current resources for blend modes PDResources resources = page.getResources(); if (resources == null) { return false; } for (COSName name : resources.getExtGStateNames()) { PDExtendedGraphicsState extGState = resources.getExtGState(name); if (extGState == null) { // can happen if key exists but no value // see PDFBOX-3950-23EGDHXSBBYQLKYOKGZUOVYVNE675PRD.pdf continue; } BlendMode blendMode = extGState.getBlendMode(); if (blendMode != BlendMode.NORMAL) { return true; } } return false; }
for (COSName name : resources.getExtGStateNames())
public void run() throws IOException { PDPage page = getPage(); processPage(page); PDResources res = page.getResources(); for (COSName name : res.getExtGStateNames()) { PDSoftMask softMask = res.getExtGState(name).getSoftMask(); if (softMask != null) { PDTransparencyGroup group = softMask.getGroup(); if (group != null) { // PDFBOX-4327: without this line NPEs will occur res.getExtGState(name).copyIntoGraphicsState(getGraphicsState()); processSoftMask(group); } } } }
private static void parseResourcesExtGState(PDResources resources) { for (COSName name : resources.getExtGStateNames()) { PDExtendedGraphicsState extGState = resources.getExtGState(name); processExtGState(extGState); } }
private Set<String> parseExGStateFromResource(PDResources resources) { if (resources == null || resources.getExtGStateNames() == null) { return null; } Set<String> gStatesIDs = new HashSet<>(); for (COSName name : resources.getExtGStateNames()) { COSDictionary dict = (COSDictionary) resources.getCOSObject().getDictionaryObject(COSName.EXT_G_STATE); COSBase base = dict.getItem(name); String id = getId(base, FeatureObjectType.EXT_G_STATE); gStatesIDs.add(id); if (checkIDBeforeProcess(id)) { PDExtendedGraphicsState exGState = resources.getExtGState(name); parseExGState(exGState, id); } } return gStatesIDs; }
private boolean hasBlendMode(PDPage page) { // check the current resources for blend modes PDResources resources = page.getResources(); if (resources == null) { return false; } for (COSName name : resources.getExtGStateNames()) { PDExtendedGraphicsState extGState = resources.getExtGState(name); if (extGState == null) { // can happen if key exists but no value // see PDFBOX-3950-23EGDHXSBBYQLKYOKGZUOVYVNE675PRD.pdf continue; } BlendMode blendMode = extGState.getBlendMode(); if (blendMode != BlendMode.NORMAL) { return true; } } return false; }
for (COSName name : resources.getExtGStateNames())
public void run() throws IOException { PDPage page = getPage(); processPage(page); PDResources res = page.getResources(); for (COSName name : res.getExtGStateNames()) { PDSoftMask softMask = res.getExtGState(name).getSoftMask(); if (softMask != null) { PDTransparencyGroup group = softMask.getGroup(); if (group != null) { // PDFBOX-4327: without this line NPEs will occur res.getExtGState(name).copyIntoGraphicsState(getGraphicsState()); processSoftMask(group); } } } }