Generate PDF

Generate

In this example we use iText library, we can download in this link.

Generate pdf

Then we add the library in libs file and we include this conde in your activity.

private void generateAndwritePDF() {

        // create a new document
        Document document = new Document();

        try {
            PdfWriter.getInstance(document, new FileOutputStream(mPdfFile));
            document.open();
            document.add(new Paragraph("Title"));
            document.close();

            mProgressDialog.cancel();

        } catch (Exception e) {
            e.printStackTrace();

        }

    }

And we can generate pdf in android.

Example in Github

Leave a Reply

Your email address will not be published. Required fields are marked *