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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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.