I have create an app of payroll system in android and it needs to be save the salary slip in PDF format that's why i need to create pdf of using content from SalarySlip.java. Thanks.
Asked
Active
Viewed 1,265 times
0
-
http://stackoverflow.com/questions/2499960/how-to-create-pdfs-in-an-android-app – karan Sep 18 '15 at 04:43
-
You can create pdf file by inserting content to some pdf file. I provide you the reference from where you can get the idea of how to generate pdf http://www.dynamicpdf.com/Blog/post/2012/06/15/Generating-PDFs-Dynamically-on-Android.aspx – KishuDroid Sep 18 '15 at 04:44
1 Answers
2
For devices with API level 19 or more you can use the built in PrintedPdfDocument.
This class is a helper for creating a PDF file for given print attributes. It is useful for implementing printing via the native Android graphics APIs.
// open a new document
PrintedPdfDocument document = new PrintedPdfDocument(context,printAttributes);
// start a page
Page page = document.startPage(0);
// draw something on the page
View content = getContentView();
content.draw(page.getCanvas());
// finish the page
document.finishPage(page);
. . .
// add more pages
. . .
// write the document content
document.writeTo(getOutputStream());
//close the document
document.close();
For more advance Features use iText

Maveňツ
- 1
- 12
- 50
- 89