HtmlToPdfConverter

Converts HTML to PDF document.

Note: HTML-to-PDF conversion internally relies on the system WebView implementation. This means that there are certain aspects of this conversion process that PSPDFKit can't support. This includes, for example, any possible WebView bugs.

Note: JavaScript execution is enabled by default. This could cause security and performance issues. Please review your JavaScripts carefully. If you wish to disable JavaScript execution while performing the HTML conversion, set setJavaScriptEnabled to false.

Note: This API requires HTML-to-PDF conversion feature in your license.

Types

Link copied to clipboard
Listener for page loading progress updates used when loading HTML page in .

Functions

Link copied to clipboard
open fun convertToPdfAsync(): Single<File>
Performs HTML-to-PDF conversion to a temporary file in application's cache directory.
open fun convertToPdfAsync(@NonNull outputFile: File): Completable
Performs HTML-to-PDF conversion to specified file.
Link copied to clipboard
open fun density(@IntRange(from = 1) densityDpi: Int): HtmlToPdfConverter
Sets the density that should be used when converting HTML images to PDF.
Link copied to clipboard
Checks whether PSPDFKit can perform HTML-to-PDF conversion on this device.
Link copied to clipboard
open fun fromHTMLString(@NonNull context: Context, @NonNull htmlString: String, @Nullable baseUrl: String): HtmlToPdfConverter
Creates HTML-to-PDF converter from HTML string.
Link copied to clipboard
Creates HTML-to-PDF converter from Uri.
Link copied to clipboard
Sets the size of the created PDF.
Link copied to clipboard
Enables or disables JavaScript processing.
Link copied to clipboard
Sets listener that will be called whenever page loading progress changes.
Link copied to clipboard
Sets resource interceptor that will be called whenever the HTML converter wants to load any page resource (image, stylesheet, JavaScript etc.).
Link copied to clipboard
open fun timeout(@IntRange(from = 0) timeout: Long): HtmlToPdfConverter
Sets the timeout for loading the HTML document when converting.
Link copied to clipboard
Sets the document title (set via setTitle).