/** * Gets the <code>Q</code> integer property on the AcroForm. * <br> * This method gets the default (fallback value) for the <code>Q</code> * attribute of variable text {@link PdfFormField form field}s. * * @return an integer representing a justification value * @see PdfFormField#getJustification() */ public PdfNumber getDefaultJustification() { return getPdfObject().getAsNumber(PdfName.Q); }
/** * The constant opacity value that will be used in painting the annotation. * This value is applied to all visible elements of the annotation in its closed state * (including its background and border) but not to the pop-up window that appears when * the annotation is opened. Default value: 1.0. * @return a {@link PdfNumber} which value is in range between 0 and 1, which specifies the * level of opacity. This method returns null if opacity is not specified; in this case default * value is used, which is 1. */ public PdfNumber getOpacity() { return getPdfObject().getAsNumber(PdfName.CA); }
/** * Gets the current index of the first option in a scrollable list. * @return the index of the first option, as a {@link PdfNumber} */ public PdfNumber getTopIndex() { return getPdfObject().getAsNumber(PdfName.TI); }
/** * @deprecated Will always return null. The return will be changed to PdfName in 7.2. * Use {@code getPdfObject().getAsName(PdfName.View)}, * or one of {@link #isViewDetails()}, {@link #isViewTile()}, {@link #isViewHidden()}. */ @Deprecated public PdfNumber getView() { return getPdfObject().getAsNumber(PdfName.View); }
/** * Gets the <code>Q</code> integer property on the AcroForm. * <br> * This method gets the default (fallback value) for the <code>Q</code> * attribute of variable text {@link PdfFormField form field}s. * * @return an integer representing a justification value * @see PdfFormField#getJustification() */ public PdfNumber getDefaultJustification() { return getPdfObject().getAsNumber(PdfName.Q); }
/** * Gets the key of the page’s entry in the structural parent tree. * * @return the key of the page’s entry in the structural parent tree. * If page has no entry in the structural parent tree, returned value is -1. */ public int getStructParentIndex() { return getPdfObject().getAsNumber(PdfName.StructParents) != null ? getPdfObject().getAsNumber(PdfName.StructParents).intValue() : -1; }
/** * PDF 2.0. When regenerating the annotation's appearance stream, this is the * opacity value that shall be used for stroking all visible * elements of the annotation in its closed state, including its background and border, but * not the popup window that appears when the annotation is opened. * * @return opacity for stroking operations, including background and border */ public float getStrokingOpacity() { PdfNumber strokingOpacity = getPdfObject().getAsNumber(PdfName.CA); return strokingOpacity != null ? strokingOpacity.floatValue() : 1; }
/** * Checks if this pattern have colored paint type. * * @return {@code true} if this pattern's paint type is {@link PaintType#COLORED} and {@code false} otherwise. */ public boolean isColored() { return getPdfObject().getAsNumber(PdfName.PaintType).intValue() == PaintType.COLORED; }
/** * A code specifying the form of quadding (justification) that is used in displaying the annotation's text: * 0 - Left-justified, 1 - Centered, 2 - Right-justified. Default value: 0 (left-justified). * @return a code specifying the form of quadding (justification), returns the default value if not explicitly specified. */ public int getJustification() { PdfNumber q = getPdfObject().getAsNumber(PdfName.Q); return q == null ? 0 : q.intValue(); }
/** * A non-negative number that represents the length of the leader line offset, which is the amount of empty space * between the endpoints of the annotation and the beginning of the leader lines. * @return a non-negative number that represents the length of the leader line offset, * or null if leader line offset is not set. */ public float getLeaderLineOffset() { PdfNumber n = getPdfObject().getAsNumber(PdfName.LLO); return n == null ? 0 : n.floatValue(); }
/** * Gets the maximum length of the field's text, in characters. * This is an optional parameter, so if it is not specified, <code>null</code> will be returned. * @return the current maximum text length */ public int getMaxLen() { PdfNumber number = getPdfObject().getAsNumber(PdfName.MaxLen); return number != null ? number.intValue() : 0; }
/** * Gets the maximum length of the field's text, in characters. * This is an optional parameter, so if it is not specified, <code>null</code> will be returned. * @return the current maximum text length */ public int getMaxLen() { PdfNumber number = getPdfObject().getAsNumber(PdfName.MaxLen); return number != null ? number.intValue() : 0; }
/** * A code specifying the form of quadding (justification) that is used in displaying the annotation's text: * 0 - Left-justified, 1 - Centered, 2 - Right-justified. Default value: 0 (left-justified). * @return a code specifying the form of quadding (justification), returns the default value if not explicitly specified. */ public int getJustification() { PdfNumber q = getPdfObject().getAsNumber(PdfName.Q); return q == null ? 0 : q.intValue(); }
/** * A non-negative number that represents the length of leader line extensions that extend from the line proper * 180 degrees from the leader lines. * @return a non-negative float that represents the length of leader line extensions; or if the leader line extension * is not explicitly set, returns the default value, which is 0. */ public float getLeaderLineExtension() { PdfNumber n = getPdfObject().getAsNumber(PdfName.LLE); return n == null ? 0 : n.floatValue(); }
/** * Gets the tiling type. * * @return int value of {@link TilingType} */ public int getTilingType() { return getPdfObject().getAsNumber(PdfName.TilingType).intValue(); }
/** * The length of leader lines in default user space that extend from each endpoint of the line perpendicular * to the line itself. A positive value means that the leader lines appear in the direction that is clockwise * when traversing the line from its starting point to its ending point (as specified by {@link PdfName#L} (see {@link #getLine()}); * a negative value indicates the opposite direction. * @return a float specifying the length of leader lines in default user space. */ public float getLeaderLineLength() { PdfNumber n = getPdfObject().getAsNumber(PdfName.LL); return n == null ? 0 : n.floatValue(); }
@Override public int getMcid() { PdfNumber mcidNumber = ((PdfDictionary) getPdfObject()).getAsNumber(PdfName.MCID); return mcidNumber != null ? mcidNumber.intValue() : -1; }
public Float getAttributeAsFloat(String attributeName) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); PdfNumber attrVal = getPdfObject().getAsNumber(name); return attrVal != null ? (Float)attrVal.floatValue() : (Float)null; }
public Integer getAttributeAsInt(String attributeName) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); PdfNumber attrVal = getPdfObject().getAsNumber(name); return attrVal != null ? (Integer) attrVal.intValue() : (Integer)null; }
public AccessibilityProperties addAttributes(int index, PdfStructureAttributes attributes) { if (attributes == null) { return this; } PdfObject attributesObject = getBackingElem().getAttributes(false); PdfObject combinedAttributes = AccessibilityPropertiesToStructElem.combineAttributesList( attributesObject, index, Collections.singletonList(attributes), getBackingElem().getPdfObject().getAsNumber(PdfName.R)); getBackingElem().setAttributes(combinedAttributes); return this; }