/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * * @return a new <CODE>PdfWriter</CODE> * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument. * @throws DocumentException on error */ public static PdfWriter getInstance(final Document document, final OutputStream os, final DocListener listener) throws DocumentException { PdfDocument pdf = new PdfDocument(); pdf.addDocListener(listener); document.addDocListener(pdf); PdfWriter writer = new PdfWriter(pdf, os); pdf.addWriter(writer); return writer; }
/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument. * @param conformanceLevel PDF/A conformance level of a new PDF document * @return a new <CODE>PdfWriter</CODE> * @throws DocumentException on error */ public static PdfAWriter getInstance(final Document document, final OutputStream os, final DocListener listener, final PdfAConformanceLevel conformanceLevel) throws DocumentException { PdfDocument pdf = new PdfDocument(); pdf.addDocListener(listener); document.addDocListener(pdf); PdfAWriter writer = new PdfAWriter(pdf, os, conformanceLevel); pdf.addWriter(writer); return writer; }
/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * * @return a new <CODE>PdfWriter</CODE> * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument. * @throws DocumentException on error */ public static PdfWriter getInstance(final Document document, final OutputStream os, final DocListener listener) throws DocumentException { PdfDocument pdf = new PdfDocument(); pdf.addDocListener(listener); document.addDocListener(pdf); PdfWriter writer = new PdfWriter(pdf, os); pdf.addWriter(writer); return writer; }