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(); } }
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); }
/** * Gets height of image, {@code Height} key. * * @return float value. */ @Override public float getHeight() { if (!isFlushed()) { return getPdfObject().getAsNumber(PdfName.Height).floatValue(); } else { return height; } }
/** * Gets width of image, {@code Width} key. * * @return float value. */ @Override public float getWidth() { if (!isFlushed()) { return getPdfObject().getAsNumber(PdfName.Width).floatValue(); } else { return width; } }
/** * To manually flush a {@code PdfObject} behind this wrapper, you have to ensure * that this object is added to the document, i.e. it has an indirect reference. * Basically this means that before flushing you need to explicitly call {@link #makeIndirect(PdfDocument)}. * For example: wrapperInstance.makeIndirect(document).flush(); * Note, that not every wrapper require this, only those that have such warning in documentation. */ @Override public void flush() { if (!isFlushed()) { width = getPdfObject().getAsNumber(PdfName.Width).floatValue(); height = getPdfObject().getAsNumber(PdfName.Height).floatValue(); super.flush(); } }
boolean calc = false; int streamLength = 0; PdfNumber pdfNumber = pdfStream.getAsNumber(PdfName.Length); if (pdfNumber != null) { streamLength = pdfNumber.intValue();
throw new com.itextpdf.io.IOException(com.itextpdf.io.IOException.ColorSpaceIsNotSupported).setMessageParams(tyca.toString()); PdfStream pr = (PdfStream) ca.get(1); int n = pr.getAsNumber(PdfName.N).intValue(); if (n != 4) { throw new com.itextpdf.io.IOException(com.itextpdf.io.IOException.NValueIsNotSupported).setMessageParams(n);
int n = pr.getAsNumber(PdfName.N).intValue(); if (n == 1) { stride = (int) ((width * bpc + 7) / 8);
protected void readObjectStream(PdfStream objectStream) throws IOException { int objectStreamNumber = objectStream.getIndirectReference().getObjNumber(); int first = objectStream.getAsNumber(PdfName.First).intValue(); int n = objectStream.getAsNumber(PdfName.N).intValue(); byte[] bytes = readStreamBytes(objectStream, true); PdfTokenizer saveTokens = tokens;
ose.finish(); PdfNumber length = pdfStream.getAsNumber(PdfName.Length); length.setValue((int) (getCurrentPos() - beginStreamContent)); pdfStream.updateLength(length.intValue());