PdfArray.getAsString
Code IndexAdd Codota to your IDE (free)

Best code snippets using com.itextpdf.kernel.pdf.PdfArray.getAsString(Showing top 9 results out of 315)

origin: itext/itext7

/**
 * Gets file ID, either {@link PdfName#ID} key of trailer or a newly generated id.
 *
 * @return byte array represents file ID.
 * @see PdfEncryption#generateNewDocumentId()
 */
public byte[] getOriginalFileId() {
  PdfArray id = trailer.getAsArray(PdfName.ID);
  if (id != null) {
    return ByteUtils.getIsoBytes(id.getAsString(0).getValue());
  } else {
    return PdfEncryption.generateNewDocumentId();
  }
}
origin: itext/itext7

private PdfString iterateItems(PdfDictionary dictionary, Map<String, PdfObject> items, PdfString leftOver) {
  PdfArray names = dictionary.getAsArray(PdfName.Names);
  if (names != null) {
    for (int k = 0; k < names.size(); k++) {
      PdfString name;
      if (leftOver == null)
        name = names.getAsString(k++);
      else {
        name = leftOver;
        leftOver = null;
      }
      if (k < names.size()) {
        items.put(name.toUnicodeString(), names.get(k));
      } else {
        return name;
      }
    }
  } else if ((names = dictionary.getAsArray(PdfName.Kids)) != null) {
    for (int k = 0; k < names.size(); k++) {
      PdfDictionary kid = names.getAsDictionary(k);
      leftOver = iterateItems(kid, items, leftOver);
    }
  }
  return null;
}
origin: itext/itext7

protected static byte[] computeGlobalKeyOnReading(PdfDictionary encryptionDictionary, PrivateKey certificateKey,
                     Certificate certificate, String certificateKeyProvider,
                     IExternalDecryptionProcess externalDecryptionProcess,
                     boolean encryptMetadata, String digestAlgorithm) {
  PdfArray recipients = encryptionDictionary.getAsArray(PdfName.Recipients);
  if (recipients == null) {
    recipients = encryptionDictionary.getAsDictionary(PdfName.CF)
                    .getAsDictionary(PdfName.DefaultCryptFilter)
                    .getAsArray(PdfName.Recipients);
  }
  byte[] envelopedData = EncryptionUtils.fetchEnvelopedData(certificateKey, certificate, certificateKeyProvider,
      externalDecryptionProcess, recipients);
  byte[] encryptionKey;
  MessageDigest md;
  try {
    md = MessageDigest.getInstance(digestAlgorithm);
    md.update(envelopedData, 0, 20);
    for (int i = 0; i < recipients.size(); i++) {
      byte[] encodedRecipient = recipients.getAsString(i).getValueBytes();
      md.update(encodedRecipient);
    }
    if (!encryptMetadata) {
      md.update(new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255});
    }
    encryptionKey = md.digest();
  } catch (Exception f) {
    throw new PdfException(PdfException.PdfDecryption, f);
  }
  return encryptionKey;
}
origin: itext/itext7

PdfString cert = signature.getPdfObject().getAsString(PdfName.Cert);
if (cert == null)
  cert = signature.getPdfObject().getAsArray(PdfName.Cert).getAsString(0);
pk = new PdfPKCS7(PdfEncodings.convertToBytes(contents.getValue(), null), cert.getValueBytes(), provider);
origin: itext/itext7

PdfString newModifiedId = reader.trailer.getAsArray(PdfName.ID).getAsString(1);
origin: itext/itext7

PdfString recipient = recipients.getAsString(i);
CMSEnvelopedData data;
try {
PdfString recipient = recipients.getAsString(i);
CMSEnvelopedData data;
try {
origin: itext/itext7

PdfString valStr = null;
if (pdfObject.isArray()) {
  valStr = ((PdfArray) pdfObject).getAsString(1);
} else if (pdfObject.isString()) {
  valStr = (PdfString) pdfObject;
origin: itext/itext7

int d = -1;
for (int k = 0; k < ar.size(); k += 2) {
  PdfString s = ar.getAsString(k);
  if ("template".equals(s.toString())) {
    t = k + 1;
origin: itext/itext7

originalModifiedDocumentId = id.getAsString(1);
com.itextpdf.kernel.pdfPdfArraygetAsString

Javadoc

Returns the element at the specified index as a PdfString. If the element isn't a PdfString, null is returned.

Popular methods of PdfArray

  • <init>
    Create a new PdfArray filled with the values in the boolean[] as com.itextpdf.kernel.pdf.PdfBoolean.
  • add
  • get
  • getAsNumber
    Returns the element at the specified index as a PdfNumber. If the element isn't a PdfNumber, null is
  • size
  • toRectangle
    Returns the first four elements of this array as a PdfArray. The first four values need to be PdfNum
  • getAsDictionary
    Returns the element at the specified index as a PdfDictionary. If the element isn't a PdfDictionary,
  • getAsStream
    Returns the element at the specified index as a PdfStream. If the element isn't a PdfStream, null is
  • makeIndirect
  • remove
    Removes the PdfObject at the specified index.
  • setModified
  • addAll
    Adds the Collection of PdfObjects.
  • setModified,
  • addAll,
  • contains,
  • flush,
  • getAsName,
  • isEmpty,
  • set,
  • subList,
  • toFloatArray

Popular classes and methods

  • setScale (BigDecimal)
    Returns a new BigDecimal instance with the specified scale. If the new scale is greater than the old
  • getApplicationContext (Context)
  • getSystemService (Context)
  • Kernel (java.awt.image)
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JLabel (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)