Skip to content

Android: Printing.convertHtml hangs indefinitely on failure (Missing onLayoutFailed / onWriteFailed handling) #1897

@niteenmaurya

Description

@niteenmaurya

Describe the bug
On Android, when calling Printing.convertHtml, the Future sometimes never completes (hanging the UI with an infinite loader). This occurs when the Android PrintDocumentAdapter encounters an error during layout or writing.

Upon analyzing PdfConvert.java, I noticed that the LayoutResultCallback and WriteResultCallback only implement the onFinished methods. They miss the onFailed and onCancelled overrides.

Consequently, if the Android Print Manager fails (e.g., rendering error, memory issue), it calls onLayoutFailed, but since PdfConvert.java does not handle it, the result is never sent back to Flutter. The Dart MethodChannel waits indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions