@Override protected Node toXmlNode(Document document) { Element element = document.createElement("dictKey"); element.appendChild(document.createTextNode(key.toString())); return element; } }
/** toString method */ public String toString() { return action.toString() + (fields == null ? "" : fields.toString()); } }
/** toString method */ public String toString() { return action.toString() + (fields == null ? "" : fields.toString()); } }
private boolean compareNamesExtended(PdfName outName, PdfName cmpName, ObjectPath currentPath, CompareResult compareResult) { if (cmpName.equals(outName)) { return true; } else { if (compareResult != null && currentPath != null) compareResult.addError(currentPath, MessageFormatUtil.format("PdfName. Expected: {0}. Found: {1}", cmpName.toString(), outName.toString())); return false; } }
/** * Creates the caption for an object that is a dictionary entry. * * @param dict a dictionary * @param key a key in the dictionary * @return a caption for the object corresponding with the key in the dictionary. */ public static String getDictionaryEntryCaption(PdfDictionary dict, PdfName key) { StringBuffer buf = new StringBuffer(key.toString()); buf.append(": "); PdfObject valObj = dict.get(key, false); buf.append(getCaption(valObj)); return buf.toString(); }
@Override public String toString() { if (!isFlushed()) { String string = "<<"; for (Map.Entry<PdfName, PdfObject> entry : map.entrySet()) { PdfIndirectReference indirectReference = entry.getValue().getIndirectReference(); string = string + entry.getKey().toString() + " " + (indirectReference == null ? entry.getValue().toString() : indirectReference.toString()) + " "; } string += ">>"; return string; } else { return indirectReference.toString(); } }
protected void parseTag(PdfMcr kid) { int mcid = kid.getMcid(); PdfDictionary pageDic = kid.getPageObject(); String tagContent = ""; if (mcid != -1) { if (!parsedTags.containsKey(pageDic)) { MarkedContentEventListener listener = new MarkedContentEventListener(); PdfCanvasProcessor processor = new PdfCanvasProcessor(listener); PdfPage page = document.getPage(pageDic); processor.processContent(page.getContentBytes(), page.getResources()); parsedTags.put(pageDic, listener.getMcidContent()); } if (parsedTags.get(pageDic).containsKey(mcid)) tagContent = parsedTags.get(pageDic).get(mcid); } else { PdfObjRef objRef = (PdfObjRef) kid; PdfObject object = objRef.getReferencedObject(); if (object.isDictionary()) { PdfName subtype = ((PdfDictionary) object).getAsName(PdfName.Subtype); tagContent = subtype.toString(); } } try { out.write(escapeXML(tagContent, true)); } catch (java.io.IOException e) { throw new com.itextpdf.io.IOException(com.itextpdf.io.IOException.UnknownIOException, e); } }
} else { Logger logger = LoggerFactory.getLogger(StructureTreeCopier.class); logger.warn(MessageFormat.format(LogMessageConstant.ROLE_MAPPING_FROM_SOURCE_IS_NOT_COPIED_INVALID, entry.getKey().toString())); continue;
if (!outObj.isName() || outObj.toString().indexOf('+') == -1) { if (compareResult != null && currentPath != null) compareResult.addError(currentPath, MessageFormatUtil.format("PdfDictionary {0} entry: Expected: {1}. Found: {2}", key.toString(), cmpObj.toString(), outObj.toString())); dictsAreSame = false; } else { if (!cmpName.equals(outName)) { if (compareResult != null && currentPath != null) compareResult.addError(currentPath, MessageFormatUtil.format("PdfDictionary {0} entry: Expected: {1}. Found: {2}", key.toString(), cmpObj.toString(), outObj.toString())); dictsAreSame = false;
private boolean checkDefaultCS(PdfDictionary currentColorSpaces, Boolean fill, PdfName defaultCsName, int numOfComponents) { if (currentColorSpaces == null) return false; if (!currentColorSpaces.containsKey(defaultCsName)) return false; PdfObject defaultCsObj = currentColorSpaces.get(defaultCsName); PdfColorSpace defaultCs = PdfColorSpace.makeColorSpace(defaultCsObj); if (defaultCs instanceof PdfDeviceCs) throw new PdfAConformanceException(PdfAConformanceException.COLOR_SPACE_0_SHALL_BE_DEVICE_INDEPENDENT).setMessageParams(defaultCsName.toString()); if (defaultCs.getNumberOfComponents() != numOfComponents) throw new PdfAConformanceException(PdfAConformanceException.COLOR_SPACE_0_SHALL_HAVE_1_COMPONENTS).setMessageParams(defaultCsName.getValue(), numOfComponents); checkColorSpace(defaultCs, currentColorSpaces, false, fill); return true; } }
private boolean checkDefaultCS(PdfDictionary currentColorSpaces, Boolean fill, PdfName defaultCsName, int numOfComponents) { if (currentColorSpaces == null) return false; if (!currentColorSpaces.containsKey(defaultCsName)) return false; PdfObject defaultCsObj = currentColorSpaces.get(defaultCsName); PdfColorSpace defaultCs = PdfColorSpace.makeColorSpace(defaultCsObj); if (defaultCs instanceof PdfDeviceCs) throw new PdfAConformanceException(PdfAConformanceException.COLOR_SPACE_0_SHALL_BE_DEVICE_INDEPENDENT).setMessageParams(defaultCsName.toString()); if (defaultCs.getNumberOfComponents() != numOfComponents) throw new PdfAConformanceException(PdfAConformanceException.COLOR_SPACE_0_SHALL_HAVE_1_COMPONENTS).setMessageParams(defaultCsName.getValue(), numOfComponents); checkColorSpace(defaultCs, currentColorSpaces, false, fill); return true; } }