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

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

origin: itext/itext7

/**
 * Constructs a new PdfVisibilityExpression instance by its raw PdfArray.
 * @param visibilityExpressionArray the array representing the visibility expression
 */
public PdfVisibilityExpression(PdfArray visibilityExpressionArray) {
  super(visibilityExpressionArray);
  PdfName operator = visibilityExpressionArray.getAsName(0);
  if (visibilityExpressionArray.size() < 1 || !PdfName.Or.equals(operator)
      && !PdfName.And.equals(operator) && !PdfName.Not.equals(operator)) {
    throw new IllegalArgumentException("Invalid visibilityExpressionArray");
  }
}
origin: itext/itext7

@Override
public void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces) {
  PdfObject filter = inlineImage.get(PdfName.Filter);
  if (filter instanceof PdfName) {
    if (filter.equals(PdfName.LZWDecode)) {
      throw new PdfAConformanceException(PdfAConformanceException.LZWDECODE_FILTER_IS_NOT_PERMITTED);
    }
  } else if (filter instanceof PdfArray) {
    for (int i = 0; i < ((PdfArray) filter).size(); i++) {
      PdfName f = ((PdfArray) filter).getAsName(i);
      if (f.equals(PdfName.LZWDecode)) {
        throw new PdfAConformanceException(PdfAConformanceException.LZWDECODE_FILTER_IS_NOT_PERMITTED);
      }
    }
  }
  checkImage(inlineImage, currentColorSpaces);
}
origin: itext/itext7

public PdfName getName() {
  return ((PdfArray)getPdfObject()).getAsName(1);
}
origin: itext/itext7

private void checkSeparationCS(PdfArray separation) {
  if (separationColorSpaces.containsKey(separation.getAsName(0))) {
    boolean altCSIsTheSame;
    boolean tintTransformIsTheSame;
    PdfArray sameNameSeparation = separationColorSpaces.get(separation.getAsName(0));
    PdfObject cs1 = separation.get(2);
    PdfObject cs2 = sameNameSeparation.get(2);
    altCSIsTheSame = isAltCSIsTheSame(cs1, cs2);
    // TODO(DEVSIX-1672) in fact need to check if objects content is equal. ISO 19005-2, 6.2.4.4 "Separation and DeviceN colour spaces":
    // In evaluating equivalence, the PDF objects shall be compared, rather than the computational
    // result of the use of those PDF objects. Compression and whether or not an object is direct or indirect shall be ignored.
    PdfObject f1Obj = separation.get(3);
    PdfObject f2Obj = sameNameSeparation.get(3);
    //Can be a stream or dict
    boolean bothAllowedType = (f1Obj.getType() == f2Obj.getType()) && (f1Obj.isDictionary() || f1Obj.isStream());
    //Check if the indirect references are equal
    tintTransformIsTheSame = bothAllowedType && f1Obj.equals(f2Obj);
    if (!altCSIsTheSame || !tintTransformIsTheSame) {
      throw new PdfAConformanceException(PdfAConformanceException.TINT_TRANSFORM_AND_ALTERNATE_SPACE_SHALL_BE_THE_SAME_FOR_THE_ALL_SEPARATION_CS_WITH_THE_SAME_NAME);
    }
  } else {
    separationColorSpaces.put(separation.getAsName(0), separation);
  }
}
origin: itext/itext7

else if (pdfObject.isArray()) {
  PdfArray array = (PdfArray) pdfObject;
  PdfName csType = array.getAsName(0);
  if (PdfName.CalGray.equals(csType))
    return new PdfCieBasedCs.CalGray(array);
origin: itext/itext7

PdfName f = ((PdfArray) filter).getAsName(i);
if (f.equals(PdfName.LZWDecode))
  throw new PdfAConformanceException(PdfAConformanceException.LZWDECODE_FILTER_IS_NOT_PERMITTED);
origin: itext/itext7

} else if (filterObject instanceof PdfArray) {
  filtersArray = (PdfArray) filterObject;
  filterName = filtersArray.getAsName(0);
} else {
  throw new PdfException(PdfException.FilterIsNotANameOrArray);
origin: itext/itext7

mappedRole = mappingArr.getAsName(0);
mappedNsDict = mappingArr.getAsDictionary(1);
origin: itext/itext7

@Override
public void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces) {
  PdfObject filter = inlineImage.get(PdfName.Filter);
  if (filter instanceof PdfName) {
    if (filter.equals(PdfName.LZWDecode))
      throw new PdfAConformanceException(PdfAConformanceException.LZWDECODE_FILTER_IS_NOT_PERMITTED);
    if (filter.equals(PdfName.Crypt)) {
      throw new PdfAConformanceException(PdfAConformanceException.CRYPT_FILTER_IS_NOT_PERMITTED_INLINE_IMAGE);
    }
  } else if (filter instanceof PdfArray) {
    for (int i = 0; i < ((PdfArray) filter).size(); i++) {
      PdfName f = ((PdfArray) filter).getAsName(i);
      if (f.equals(PdfName.LZWDecode))
        throw new PdfAConformanceException(PdfAConformanceException.LZWDECODE_FILTER_IS_NOT_PERMITTED);
      if (f.equals(PdfName.Crypt)) {
        throw new PdfAConformanceException(PdfAConformanceException.CRYPT_FILTER_IS_NOT_PERMITTED_INLINE_IMAGE);
      }
    }
  }
  checkImage(inlineImage, currentColorSpaces);
}
origin: itext/itext7

/**
 * @param colorSpaceName the name of the color space. If null, a bi-tonal (black and white) color space is assumed.
 * @return the components per pixel for the specified color space
 */
private static int getComponentsPerPixel(PdfName colorSpaceName, PdfDictionary colorSpaceDic) {
  if (colorSpaceName == null)
    return 1;
  if (colorSpaceName.equals(PdfName.DeviceGray))
    return 1;
  if (colorSpaceName.equals(PdfName.DeviceRGB))
    return 3;
  if (colorSpaceName.equals(PdfName.DeviceCMYK))
    return 4;
  if (colorSpaceDic != null) {
    PdfArray colorSpace = colorSpaceDic.getAsArray(colorSpaceName);
    if (colorSpace != null) {
      if (PdfName.Indexed.equals(colorSpace.getAsName(0))) {
        return 1;
      }
    } else {
      PdfName tempName = colorSpaceDic.getAsName(colorSpaceName);
      if (tempName != null) {
        return getComponentsPerPixel(tempName, colorSpaceDic);
      }
    }
  }
  throw new InlineImageParseException(PdfException.UnexpectedColorSpace1).setMessageParams(colorSpaceName);
}
origin: itext/itext7

PdfName csType = array.getAsName(0);
if (PdfName.CalGray.equals(csType))
  return new CalGray((PdfCieBasedCs.CalGray) pdfColorSpace, getColorants(operands)[0]);
origin: itext/itext7

/**
 * PDF 2.0. Sets an array of names of Viewer preference settings that
 * shall be enforced by PDF processors and that shall not be overridden by
 * subsequent selections in the application user interface
 *
 * @param enforce array of names specifying settings to enforce in the PDF processors
 * @return this {@link PdfViewerPreferences} instance
 */
public PdfViewerPreferences setEnforce(PdfArray enforce) {
  for (int i = 0; i < enforce.size(); i++) {
    PdfName curEnforce = enforce.getAsName(i);
    if (curEnforce == null) {
      throw new IllegalArgumentException("Enforce array shall contain PdfName entries");
    } else if (PdfName.PrintScaling.equals(curEnforce)) {
      // This name may appear in the Enforce array only if the corresponding entry in
      // the viewer preferences dictionary specifies a valid value other than AppDefault
      PdfName curPrintScaling = getPdfObject().getAsName(PdfName.PrintScaling);
      if (curPrintScaling == null || PdfName.AppDefault.equals(curPrintScaling)) {
        throw new PdfException(PdfException.PrintScalingEnforceEntryInvalid);
      }
    }
  }
  return put(PdfName.Enforce, enforce);
}
com.itextpdf.kernel.pdfPdfArraygetAsName

Javadoc

Returns the element at the specified index as a PdfName. If the element isn't a PdfName, 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
  • getAsString
    Returns the element at the specified index as a PdfString. If the element isn't a PdfString, null is
  • makeIndirect
  • remove
    Removes the PdfObject at the specified index.
  • setModified
  • remove,
  • setModified,
  • addAll,
  • contains,
  • flush,
  • isEmpty,
  • set,
  • subList,
  • toFloatArray

Popular classes and methods

  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with val. Returns one of the three values 1, 0, or -1. The method behaves a
  • runOnUiThread (Activity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Format (java.text)
    Format is an abstract base class for formatting locale-sensitive information such as dates, messages
  • LinkedHashMap (java.util)
    Hash table implementation of the Map interface with predictable iteration order. [Sun docs] [http:/
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers

For IntelliJ IDEA and
Android Studio

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