Skip to content

Commit 4809e72

Browse files
committed
refactor(android): remove unused PDF helper classes and methods
Cleanup unused code to reduce library size and complexity. All PDF generation now uses PdfConverter exclusively.
1 parent 96120d8 commit 4809e72

4 files changed

Lines changed: 0 additions & 295 deletions

File tree

android/src/main/java/android/print/PdfPrint.java

Lines changed: 0 additions & 93 deletions
This file was deleted.

android/src/main/java/android/print/PdfPrintHelper.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

android/src/main/java/android/print/PdfPrinter.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

android/src/main/java/com/margelo/nitro/nitrohtmlpdf/NitroHtmlPdf.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,6 @@ class NitroHtmlPdf : HybridNitroHtmlPdfSpec() {
244244
}
245245
}
246246

247-
private fun printWebViewToPdf(webView: WebView, outputFile: File, printAttrs: android.print.PrintAttributes, callback: (Boolean, String?) -> Unit) {
248-
Handler(Looper.getMainLooper()).post {
249-
android.print.PdfPrintHelper.printWebViewToPdf(webView, outputFile, printAttrs,
250-
object : android.print.PdfPrintHelper.PrintCallback {
251-
override fun onSuccess() {
252-
callback(true, null)
253-
}
254-
override fun onFailure(error: String?) {
255-
callback(false, error)
256-
}
257-
})
258-
}
259-
}
260-
261247
private fun mergePdfs(contentFile: File, headerFile: File?, footerFile: File?, outputFile: File, options: PdfOptions) {
262248
com.tom_roush.pdfbox.android.PDFBoxResourceLoader.init(context)
263249

@@ -384,18 +370,6 @@ class NitroHtmlPdf : HybridNitroHtmlPdfSpec() {
384370
<body>$html</body>
385371
</html>"""
386372
}
387-
388-
private fun createWebView(width: Int, height: Int): WebView {
389-
return WebView(context).apply {
390-
settings.javaScriptEnabled = false
391-
settings.domStorageEnabled = true
392-
measure(
393-
android.view.View.MeasureSpec.makeMeasureSpec(width, android.view.View.MeasureSpec.EXACTLY),
394-
android.view.View.MeasureSpec.makeMeasureSpec(height, android.view.View.MeasureSpec.EXACTLY)
395-
)
396-
layout(0, 0, width, height)
397-
}
398-
}
399373

400374

401375
private fun getPageSize(size: String): PDRectangle {

0 commit comments

Comments
 (0)