@Override protected PdfObject newInstance() { return new PdfName(); }
public static PdfName convertRoleToPdfName(String role) { PdfName name = PdfName.staticNames.get(role); if (name != null) { return name; } name = staticRoleNames.get(role); if (name != null) { return name; } name = new PdfName(role); staticRoleNames.put(role, name); return name; }
/** * Create a new PdfArray filled with a list of Strings. The boolean value decides if the Strings * should be added as {@link com.itextpdf.kernel.pdf.PdfName} (true) or as {@link com.itextpdf.kernel.pdf.PdfString} (false). * * @param strings list of strings to be added to the list * @param asNames indicates whether the strings should be added as PdfName (true) or as PdfString (false) */ public PdfArray(List<String> strings, boolean asNames) { list = new ArrayList<>(strings.size()); for (String s : strings) { list.add(asNames ? (PdfObject) new PdfName(s) : new PdfString(s)); } }
public PdfName toPdfName() { return new PdfName(MessageFormatUtil.format("{0}.{1}", major, minor)); }
public String getMoreInfo(String key) { return getStringValue(new PdfName(key)); }
protected PdfName readPdfName(boolean readAsDirect) { if (readAsDirect) { PdfName cachedName = PdfName.staticNames.get(tokens.getStringValue()); if (cachedName != null) return cachedName; } // an indirect name (how odd...), or a non-standard one return new PdfName(tokens.getByteContent()); }
/** * Sets the signature created property in the Prop_Build dictionary's App * dictionary. * * @param name String name of the application creating the signature */ public void setSignatureCreator(String name) { getPdfObject().put(PdfName.Name, new PdfName(name)); }
/** * Sets the signature created property in the Prop_Build dictionary's App * dictionary. * * @param name String name of the application creating the signature */ public void setSignatureCreator(String name) { getPdfObject().put(PdfName.Name, new PdfName(name)); }
private PdfName getHashAlgorithmNameInCompatibleForPdfForm(String hashAlgorithm) { PdfName pdfCompatibleName = null; String hashAlgOid = DigestAlgorithms.getAllowedDigest(hashAlgorithm); if (hashAlgOid != null) { String hashAlgorithmNameInCompatibleForPdfForm = DigestAlgorithms.getDigest(hashAlgOid); if (hashAlgorithmNameInCompatibleForPdfForm != null) { pdfCompatibleName = new PdfName(hashAlgorithmNameInCompatibleForPdfForm); } } return pdfCompatibleName; }
private PdfName getHashAlgorithmNameInCompatibleForPdfForm(String hashAlgorithm) { PdfName pdfCompatibleName = null; String hashAlgOid = DigestAlgorithms.getAllowedDigest(hashAlgorithm); if (hashAlgOid != null) { String hashAlgorithmNameInCompatibleForPdfForm = DigestAlgorithms.getDigest(hashAlgOid); if (hashAlgorithmNameInCompatibleForPdfForm != null) { pdfCompatibleName = new PdfName(hashAlgorithmNameInCompatibleForPdfForm); } } return pdfCompatibleName; }
/** * Constructs a PDF Collection Sort Dictionary. * * @param key the key of the field that will be used to sort entries */ public PdfCollectionSort(String key) { this(new PdfDictionary()); getPdfObject().put(PdfName.S, new PdfName(key)); }
/** * Sets the value of the collection item. * @param n */ public void addItem(String key, PdfNumber n) { PdfCollectionField field = schema.getField(key); if (field.subType == PdfCollectionField.NUMBER) { getPdfObject().put(new PdfName(key), n); } }
/** * Adds a Collection field to the Schema. * @param name the name of the collection field * @param field a Collection Field */ public PdfCollectionSchema addField(String name, PdfCollectionField field) { getPdfObject().put(new PdfName(name), field.getPdfObject()); return this; }
public Separation(String name, PdfColorSpace alternateSpace, PdfFunction tintTransform) { this(new PdfName(name), alternateSpace.getPdfObject(), tintTransform.getPdfObject()); if (!tintTransform.checkCompatibilityWithColorSpace(alternateSpace)) { throw new PdfException(PdfException.FunctionIsNotCompatibleWitColorSpace, this); } }
public void setMoreInfo(String key, String value) { PdfName keyName = new PdfName(key); if (value == null) { infoDictionary.remove(keyName); infoDictionary.setModified(); } else { put(keyName, new PdfString(value, PdfEncodings.UNICODE_BIG)); } }
public PdfStructureAttributes addEnumAttribute(String attributeName, String attributeValue) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); getPdfObject().put(name, new PdfName(attributeValue)); setModified(); return this; }
/** * Sets the value of the collection item. * @param key * @param value */ public PdfCollectionItem addItem(String key, String value) { PdfCollectionField field = schema.getField(key); getPdfObject().put(new PdfName(key), field.getValue(value)); return this; }
/** * Sets the value of the collection item. * @param d */ public void addItem(String key, PdfDate d) { PdfCollectionField field = schema.getField(key); if (field.subType == PdfCollectionField.DATE) { getPdfObject().put(new PdfName(key), d.getPdfObject()); } }
/** * Indicates that the group contains a pagination artifact. * @param pe one of the following names: "HF" (Header Footer), * "FG" (Foreground), "BG" (Background), or "L" (Logo). */ public void setPageElement(String pe) { PdfDictionary usage = getUsage(); PdfDictionary dic = new PdfDictionary(); dic.put(PdfName.Subtype, new PdfName(pe)); usage.put(PdfName.PageElement, dic); usage.setModified(); }
private PdfName getSignatureHashKey(String signatureName) throws NoSuchAlgorithmException, IOException { PdfSignature sig = sgnUtil.getSignature(signatureName); PdfString contents = sig.getContents(); byte[] bc = PdfEncodings.convertToBytes(contents.getValue(), null); byte[] bt = null; if (PdfName.ETSI_RFC3161.equals(sig.getSubFilter())) { ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(bc)); ASN1Primitive pkcs = din.readObject(); bc = pkcs.getEncoded(); } bt = hashBytesSha1(bc); return new PdfName(convertToHex(bt)); }