private PDAppearanceContentStream getAppearanceEntryAsContentStream( PDAppearanceEntry appearanceEntry, boolean compress) throws IOException { PDAppearanceStream appearanceStream = appearanceEntry.getAppearanceStream(); setTransformationMatrix(appearanceStream); // ensure there are resources PDResources resources = appearanceStream.getResources(); if (resources == null) { resources = new PDResources(); appearanceStream.setResources(resources); } return new PDAppearanceContentStream(appearanceStream, compress); }
/** * Returns the appearance stream for this annotation, if any. The annotation state is taken into account, if * present. */ public PDAppearanceStream getNormalAppearanceStream() { PDAppearanceDictionary appearanceDict = getAppearance(); if (appearanceDict == null) { return null; } PDAppearanceEntry normalAppearance = appearanceDict.getNormalAppearance(); if (normalAppearance == null) { return null; } if (normalAppearance.isSubDictionary()) { COSName state = getAppearanceState(); return normalAppearance.getSubDictionary().get(state); } else { return normalAppearance.getAppearanceStream(); } }
if (appearance != null && appearance.isStream()) appearanceStream = appearance.getAppearanceStream();
private static void addAllAppearances(PDAppearanceEntry appearance, List<PDAppearanceStream> list) { if (appearance == null) { return; } if (appearance.isStream()) { PDAppearanceStream appearanceStream = appearance.getAppearanceStream(); if (appearanceStream != null) { list.add(appearanceStream); } } else { for (PDAppearanceStream appearanceStream : appearance.getSubDictionary().values()) { if (appearanceStream != null) { list.add(appearanceStream); } } } }
private PDAppearanceContentStream getAppearanceEntryAsContentStream(PDAppearanceEntry appearanceEntry) throws IOException { PDAppearanceStream appearanceStream = appearanceEntry.getAppearanceStream(); setTransformationMatrix(appearanceStream); return new PDAppearanceContentStream(appearanceStream); }
private Set<String> getAppearanceEntryDependencies(PDAppearanceEntry entry, COSBase entryLink) { Set<String> res = new HashSet<>(); if (entry.isStream()) { res.add(getAppearanceStreamDependencies(entry.getAppearanceStream(), entryLink)); } else { for (Map.Entry<COSName, PDAppearanceStream> mapEntry : entry.getSubDictionary().entrySet()) { res.add(getAppearanceStreamDependencies(mapEntry.getValue(), ((COSDictionary) entry.getCOSObject()).getItem(mapEntry.getKey()))); } } return res; }
private void addContentStreamsFromAppearanceEntry(COSBase appearanceEntry, List<PDContentStream> appearances) { if (appearanceEntry != null) { PDAppearanceEntry newAppearance = new PDAppearanceEntry(appearanceEntry); if (newAppearance.isStream()) { addAppearance(appearances, newAppearance.getAppearanceStream()); } else { Map<COSName, PDAppearanceStream> subDictionary = newAppearance.getSubDictionary(); for (PDAppearanceStream stream : subDictionary.values()) { addAppearance(appearances, stream); } } } }
/** * Returns the appearance stream for this annotation, if any. The annotation state is taken into account, if * present. */ public PDAppearanceStream getNormalAppearanceStream() { PDAppearanceDictionary appearanceDict = getAppearance(); if (appearanceDict == null) { return null; } PDAppearanceEntry normalAppearance = appearanceDict.getNormalAppearance(); if (normalAppearance == null) { return null; } if (normalAppearance.isSubDictionary()) { COSName state = getAppearanceState(); return normalAppearance.getSubDictionary().get(state); } else { return normalAppearance.getAppearanceStream(); } }
/** * Returns the appearance stream for this annotation, if any. The annotation state is taken into account, if * present. */ public PDAppearanceStream getNormalAppearanceStream() { PDAppearanceDictionary appearanceDict = getAppearance(); if (appearanceDict == null) { return null; } PDAppearanceEntry normalAppearance = appearanceDict.getNormalAppearance(); if (normalAppearance == null) { return null; } if (normalAppearance.isSubDictionary()) { COSName state = getAppearanceState(); return normalAppearance.getSubDictionary().get(state); } else { return normalAppearance.getAppearanceStream(); } }
void handleOpacity(float opacity) throws IOException { if (opacity < 1) { PDExtendedGraphicsState gs = new PDExtendedGraphicsState(); gs.setStrokingAlphaConstant(opacity); gs.setNonStrokingAlphaConstant(opacity); PDAppearanceStream appearanceStream = appearanceEntry.getAppearanceStream(); PDResources resources = appearanceStream.getResources(); if (resources == null) { resources = new PDResources(); appearanceStream.setResources(resources); contentStream.setResources(resources); } contentStream.setGraphicsStateParameters(gs); } }
if (appearance != null && appearance.isStream()) appearanceStream = appearance.getAppearanceStream();
if (appearance != null && appearance.isStream()) appearanceStream = appearance.getAppearanceStream();