Itext 5 – creating custom PDF in android

itext pdf

Creating custom PDF using iText, iText Software is a global specialist in PDF. As a PDF library, it can be embedded into document solution workflows in industries such as; Legal, Finance, Governance, IT, Operations and more.We are using iText 5 here you can check there examples here.

The output is something like the image shown below.

itext pdf logicchip example
pdf created using itext

Adding iText dependency

First add dependencies for iText5, We are using Material design 2 here .

Main Activity

Conversion from array-list to PDF document took place in MainActivity. The array-list are provided by class Footer is created using class. First we need to provide the location of the file in order to save it, run-time permission is required for accessing the storage of the device. This example shows a list of objects and the goal is to make PDF out of that list. We used table ( PdfPTable ) to arrange the contents to ensure the correct look and feel there are lot of other objects available for arranging contents to choose from. Different types of paper sizes are available also in the library, here it’s A4 because it’s the most common size used for billing . You can also include custom fonts to make the PDF more
appealing to the user. In this example we used custom fonts and images to change the look and feel of the PDF.

itext pdf

HeaderFooter class is used for creating footer of the PDF, so users can add there company name and email at the bottom of PDF.

Leave a Reply

%d bloggers like this: