Skip to content

PDF export WebView swallows load errors silently #1036

@jim-daf

Description

@jim-daf

Summary

The WebViewClient used to render notes to PDF in app/src/main/java/android/print/PdfExtensions.kt overrides onPageFinished but does not override onReceivedError. The onPageFinished handler immediately hands the WebView off to createPrintDocumentAdapter(...), so a failed load (for example a remote image referenced in note content not being reachable) still ends up triggering the print pipeline and produces a PDF that is silently missing pieces.

Because the WebViewClient does not surface the error, neither the user nor logcat knows that anything went wrong. The only way to discover the failure today is to inspect the resulting PDF.

Proposal

Add a minimal onReceivedError(view, errorCode, description, failingUrl) override that logs the error code, description and failing URL with Log.w. Logging only, no UI change, no change to the happy path.

The deprecated 4-arg signature is used on purpose because minSdk is 21 and that signature is the one the framework dispatches on every supported API level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions