Example usage for com.itextpdf.text.pdf PdfAStamper close

List of usage examples for com.itextpdf.text.pdf PdfAStamper close

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfAStamper close.

Prototype

public void close() throws DocumentException, IOException 

Source Link

Document

Closes the document.

Usage

From source file:io.konik.carriage.itext.ITextInvoiceAppender.java

License:Open Source License

/**
 * Append invoice intern.//from   w  ww.ja  va2s  .  c  om
 *
 * @param appendable the appendable
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws DocumentException the document exception
 * @throws XMPException the XMP exception
 */
private void appendInvoiceIntern(AppendParameter appendable)
        throws IOException, DocumentException, XMPException {
    byte[] attachmentFile = convertToByteArray(appendable.attachmentFile());
    PdfReader reader = new PdfReader(appendable.inputPdf());
    PdfAStamper stamper = new PdfAStamper(reader, appendable.resultingPdf(), PdfAConformanceLevel.PDF_A_3B);

    appendZfMetadata(stamper, appendable.zugferdConformanceLevel(), appendable.zugferdVersion());
    attachFile(attachmentFile, stamper);

    stamper.close();
    reader.close();
}