/** * Writes the PDF representation of this <CODE>PdfArray</CODE> as an array of <CODE>byte</CODE> to * the specified <CODE>OutputStream</CODE>. * * @param writer for backwards compatibility * @param os the <CODE>OutputStream</CODE> to write the bytes to. */ @Override public void toPdf(final PdfWriter writer, final OutputStream os) throws IOException { PdfWriter.checkPdfIsoConformance(writer, PdfIsoKeys.PDFISOKEY_OBJECT, this); os.write('['); Iterator<PdfObject> i = arrayList.iterator(); PdfObject object; int type = 0; if (i.hasNext()) { object = i.next(); if (object == null) object = PdfNull.PDFNULL; object.toPdf(writer, os); } while (i.hasNext()) { object = i.next(); if (object == null) object = PdfNull.PDFNULL; type = object.type(); if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING) os.write(' '); object.toPdf(writer, os); } os.write(']'); }
/** * Writes the PDF representation of this <CODE>PdfDictionary</CODE> as an array of <CODE>byte * </CODE> to the given <CODE>OutputStream</CODE>. * * @param writer for backwards compatibility * @param os the <CODE>OutputStream</CODE> to write the bytes to. * @throws IOException */ @Override public void toPdf(final PdfWriter writer, final OutputStream os) throws IOException { os.write('<'); os.write('<'); // loop over all the object-pairs in the HashMap PdfObject value; int type = 0; for (Entry<PdfName, PdfObject> e : hashMap.entrySet()) { e.getKey().toPdf(writer, os); value = e.getValue(); type = value.type(); if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING) os.write(' '); value.toPdf(writer, os); } os.write('>'); os.write('>'); }
public void toPdf(PdfWriter writer, java.io.OutputStream os) throws java.io.IOException { if (os instanceof OutputStreamCounter) position = ((OutputStreamCounter) os).getCounter(); super.toPdf(writer, os); }