/** * Returns the resources needed for the object that was used to create * this PdfResourceCounter. If you pass a Map with resources that were * already used by other objects, these objects will not be taken into * account. * * @param res The resources that can be excluded when counting the bytes. * @return The number of bytes needed for an object. */ public long getLength(Map<Integer, PdfObject> res) { long length = 0; for (int ref : resources.keySet()) { if (res != null && res.containsKey(ref)) { continue; } PdfOutputStream os = new PdfOutputStream(new IdelOutputStream()); os.write(resources.get(ref).clone()); length += os.getCurrentPos(); } return length; } }
return obj; return obj.clone();
for (int i = 1; i <= document.getNumberOfPages(); i++) { PdfObject resources = document.getPage(i).getPdfObject().getAsDictionary(PdfName.Resources); initialPageResourceClones.put(i, resources == null ? null : resources.clone());
for (int i = 1; i <= document.getNumberOfPages(); i++) { PdfObject resources = document.getPage(i).getPdfObject().getAsDictionary(PdfName.Resources); initialPageResourceClones.put(i, resources == null ? null : resources.clone());