PdfDocument
public
class
PdfDocument
extends Object
| java.lang.Object | |
| ↳ | android.graphics.pdf.PdfDocument |
This class enables generating a PDF document from native Android content. You create a new document and then for every page you want to add you start a page, write content to the page, and finish the page. After you are done with all pages, you write the document to an output stream and close the document. After a document is closed you should not use it anymore. Note that pages are created one by one, i.e. you can have only a single page to which you are writing at any given time. This class is not thread safe.
A typical use of the APIs looks like this:
// create a new document PdfDocument document = new PdfDocument(); // create a page description PageInfo pageInfo = new PageInfo.Builder(100, 100, 1).create(); // start a page Page page = document.startPage(pageInfo); // 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();
Summary
Nested classes | |
|---|---|
class |
PdfDocument.Page
This class represents a PDF document page. |
class |
PdfDocument.PageInfo
This class represents meta-data that describes a PDF |
Public constructors | |
|---|---|
PdfDocument()
Creates a new instance. |
|