generatePdfWithHtml

fun generatePdfWithHtml(html: String, pdfTitle: String, onPdfPrinted: () -> Unit)

Generates a PDF file from the provided HTML content.

This method loads the given HTML content into a WebView, creates a print adapter from the WebView, and uses the PrintManager to generate a PDF document with the specified title.

Example usage:

val pdfGenerator = PdfGenerator(context)
val htmlContent = "<html><body><h1>Hello, World!</h1></body></html>"
pdfGenerator.generatePdfWithHtml(htmlContent, "SamplePDF")

Parameters

html

The HTML content to be converted into a PDF.

pdfTitle

The title of the PDF document.

onPdfPrinted

Callback to be invoked when the PDF is printed.