private int normalizeFirstLastChar(PdfNumber firstLast, int defaultValue) { if (firstLast == null) return defaultValue; int result = firstLast.intValue(); return result < 0 || result > 255 ? defaultValue : result; } }
/** * Gets object stream size (number of objects inside). * * @return object stream size. */ public int getSize() { return size.intValue(); }
/** * {@inheritDoc} */ public void invoke(PdfCanvasProcessor processor, PdfLiteral oper, List<PdfObject> operands) { int lineCap = ((PdfNumber) operands.get(0)).intValue(); processor.getGraphicsState().setLineCapStyle(lineCap); } }
/** * {@inheritDoc} */ public void invoke(PdfCanvasProcessor processor, PdfLiteral operator, List<PdfObject> operands) { PdfNumber render = (PdfNumber) operands.get(0); processor.getGraphicsState().setTextRenderingMode(render.intValue()); } }
/** * {@inheritDoc} */ public void invoke(PdfCanvasProcessor processor, PdfLiteral oper, List<PdfObject> operands) { int lineJoin = ((PdfNumber) operands.get(0)).intValue(); processor.getGraphicsState().setLineJoinStyle(lineJoin); } }
@Override public String toString() { if (content != null) { return new String(content); } else if (isDouble) { return new String(ByteUtils.getIsoBytes(getValue())); } else { return new String(ByteUtils.getIsoBytes(intValue())); } }
/** * Gets the tiling type. * * @return int value of {@link TilingType} */ public int getTilingType() { return getPdfObject().getAsNumber(PdfName.TilingType).intValue(); }
@Override public int getMcid() { PdfNumber mcidNumber = ((PdfDictionary) getPdfObject()).getAsNumber(PdfName.MCID); return mcidNumber != null ? mcidNumber.intValue() : -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; }
PdfStream(long offset, PdfDictionary keys) { super(); this.compressionLevel = CompressionConstants.UNDEFINED_COMPRESSION; this.offset = offset; putAll(keys); PdfNumber length = getAsNumber(PdfName.Length); if (length == null) { this.length = 0; } else { this.length = length.intValue(); } }
/** * 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 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(); }
/** * 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; }
public int getParentTreeNextKey() { // /ParentTreeNextKey entry is always inited on ParentTreeHandler initialization return getPdfObject().getAsNumber(PdfName.ParentTreeNextKey).intValue(); }
private void prepareAndFindColorspace(PdfObject colorspace) { pngColorType = -1; width = getPdfObject().getAsNumber(PdfName.Width).intValue(); height = getPdfObject().getAsNumber(PdfName.Height).intValue(); bpc = getPdfObject().getAsNumber(PdfName.BitsPerComponent).intValue(); pngBitDepth = bpc; palette = null; icc = null; stride = 0; findColorspace(colorspace, true); }
public Integer getAttributeAsInt(String attributeName) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); PdfNumber attrVal = getPdfObject().getAsNumber(name); return attrVal != null ? (Integer) attrVal.intValue() : (Integer)null; }
/** * 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; }
private void write(PdfNumber pdfNumber) { if (pdfNumber.hasContent()) { writeBytes(pdfNumber.getInternalContent()); } else if (pdfNumber.isDoubleNumber()) { writeDouble(pdfNumber.getValue()); } else { writeInteger(pdfNumber.intValue()); } }
public void addPages(PdfPages pdfPages) { kids.add(pdfPages.getPdfObject()); count.setValue(count.intValue() + pdfPages.getCount()); pdfPages.getPdfObject().put(PdfName.Parent, getPdfObject()); setModified(); }