Generate
In this example we use iText library, we can download in this link.
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.