
PdfWriter pdfWriter = PdfWriter.getInstance(document, bao) In this system, it is written to an output stream.īyteArrayOutputStream bao = new ByteArrayOutputStream() Through the writer (Writer), the document can be written to a disk or an output stream.

Establish a writer (Writer) to associate with the document object. The above margin data is obtained by experimenting one by one after adding picture borders.Ģ. The five parameters represent: the first parameter pageSize of the construction function is the size of the document page, and the following four parameters represent the left, right, top, and bottom margins. The above has created a standard A4 paper document. Create an object of class:ĭocument document = new Document(PageSize.A4, 110, 110, 120, 140)
ITEXT PDFWRITER SETENCRYPTION PDF
jar file.ĥ steps are required to generate PDF documents with iText:ġ. zip, and you can manually change it to a. Note: The suffix of the package downloaded here is. The pdf encryption standard uses another package- bcprov-jdk15-137.jar (official website)īecause the jar package used here is related to the java version used by the system, this system uses jdk1.5.0_08, so download bcprov-jdk15-137.jar. IText's Asian font support package because Japanese fonts are required in this system Official download this system uses the latest jar package: itext-2.0.5.jar Not only can generate PDF or rtf documents through iText, but also convert XML and Html files into PDF files. IText is a project of the well-known open source site sourceforge, a java class library used to generate PDF documents. Introduction to iText and preliminary preparation:
