java.lang.Object | |
↳ | com.pdftron.pdf.utils.HTML2PDF |
Utility class to convert HTML to PDF. API 19+ only.
The following permissions are required:
Sample usage:
HTML2PDF.fromUrl(activity, someLink, new HTML2PDF.HTML2PDFListener() { public void onConversionFinished(String pdfOutput) { } public void onConversionFailed() { } });
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | HTML2PDF.HTML2PDFListener |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final String | TAG |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
HTML2PDF(Context context) | |||||||||||
HTML2PDF(WebView webView) | |||||||||||
HTML2PDF(WebView webView, Uri outputFolderUri) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | doHtml2Pdf() | ||||||||||
static void |
fromHTMLDocument(Context context, String baseUrl, String htmlDocument, HTML2PDF.HTML2PDFListener listener)
Convert from HTML document
| ||||||||||
void |
fromHTMLDocument(String baseUrl, String htmlDocument)
Convert from HTML document
| ||||||||||
static void |
fromUrl(Context context, String url, File folder, HTML2PDF.HTML2PDFListener listener)
Convert from a URL link
| ||||||||||
static void |
fromUrl(Context context, String url, Uri folder, String outputFileName, HTML2PDF.HTML2PDFListener listener)
Convert from a URL link
| ||||||||||
void |
fromUrl(String url)
Convert from a URL link
| ||||||||||
static void |
fromUrl(Context context, String url, HTML2PDF.HTML2PDFListener listener)
Convert from a URL link
| ||||||||||
static void |
fromUrl(Context context, String url, Uri folder, HTML2PDF.HTML2PDFListener listener)
Convert from a URL link
| ||||||||||
static void |
fromWebView(WebView webView, HTML2PDF.HTML2PDFListener listener)
Convert from content in a WebView
| ||||||||||
void | setHTML2PDFListener(HTML2PDF.HTML2PDFListener listener) | ||||||||||
void |
setHorizontalDpi(int horizontalDpi)
The horizontal dpi, default to 600
| ||||||||||
void |
setMargins(PrintAttributes.Margins margins)
The margin, default to PrintAttributes.Margins.NO_MARGINS
| ||||||||||
void |
setMediaSize(PrintAttributes.MediaSize mediaSize)
The page size, default to PrintAttributes.MediaSize.NA_LETTER
| ||||||||||
void |
setOutputFileName(String fileName)
The output file name, default to website title.
| ||||||||||
void |
setOutputFolder(Uri outputFolder)
The output folder path, default to "Download/HTML2PDF"
| ||||||||||
void |
setOutputFolder(File outputFolder)
The output folder path, default to "Download/HTML2PDF"
| ||||||||||
void |
setVerticalDpi(int verticalDpi)
The vertical dpi, default to 600
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Convert from HTML document
context | the context |
---|---|
baseUrl | the base URL |
htmlDocument | the HTML string |
listener | the listener |
Convert from HTML document
baseUrl | the base URL |
---|---|
htmlDocument | the HTML string |
Convert from a URL link
context | the context |
---|---|
url | the link |
folder | the destination folder |
listener | the listener |
Convert from a URL link
context | the context |
---|---|
url | the link |
folder | the destination folder |
listener | the listener |
Convert from a URL link
url | the URL link |
---|
Convert from a URL link
context | the context |
---|---|
url | the link |
listener | the listener |
Convert from a URL link
context | the context |
---|---|
url | the link |
folder | the destination folder |
listener | the listener |
Convert from content in a WebView
webView | the WebView |
---|---|
listener | the listener |
The horizontal dpi, default to 600
horizontalDpi | The horizontal dpi |
---|
The margin, default to PrintAttributes.Margins.NO_MARGINS
margins | The margin |
---|
The page size, default to PrintAttributes.MediaSize.NA_LETTER
mediaSize | The page size |
---|
The output file name, default to website title.
fileName | the output file name |
---|
The output folder path, default to "Download/HTML2PDF"
outputFolder | The output path as a Uri |
---|
The output folder path, default to "Download/HTML2PDF"
outputFolder | The output file path |
---|
The vertical dpi, default to 600
verticalDpi | The vertical dpi |
---|