Skip to content

[syncfusion_flutter_pdfviewer] App freezes when reopening a saved AcroForm PDF (Android ANR + iOS hang) #2514

@Diamantto

Description

@Diamantto

Bug description

Description

We found a reproducible freeze when working with specific AcroForm PDFs in syncfusion_flutter_pdfviewer.

The original PDF opens normally.
After editing any form field and saving the document, reopening the saved PDF causes the app to hang.

This is reproducible on both Android and iOS.

Packages

  • syncfusion_flutter_pdfviewer: 31.2.2 and 32.2.7

Environment

  • Flutter: 3.35.5
  • Android: reproduced on multiple devices (as well as customers' devices)
  • iOS: reproduced on iPhone (as well as customers' devices)

Actual result

  • Reopening the saved file freezes the app.
  • Android stack traces show ANR from main/UI thread wait paths.

Expected result

  • Saved file should reopen normally and remain editable again.

Additional findings

  • I minimized the problematic PDF to one last page only, with only 3-4 AcroForm fields and one signature field.
  • The issue still reproduces with this reduced file.
  • This suggests the problem is likely tied to the specific AcroForm structure/metadata, not PDF size or page count.

Steps to reproduce

Repro steps

  1. Open the PDF in SfPdfViewer.
  2. (Optional) Enter any text (even 1 character) in any AcroForm text field.
  3. Save using PdfViewerController.saveDocument().
  4. Reopen the saved file.
  5. App freezes (Android reports ANR; iOS UI hangs).

Code sample

Code sample
## Minimal usage snippet
final controller = PdfViewerController();

SfPdfViewer.file(
  file,
  controller: controller,
);

// After editing form fields:
final savedBytes = await controller.saveDocument();

Screenshots or Video

Screenshots / Video demonstration

pdf without privacy.pdf

Image

Stack Traces

Stack Traces
ApplicationNotResponding: Background ANR
  libc                0x012188c    mmap
  base.apk            0x20079d0    null
  base.apk            0x20217e8    null
  base.apk            0x2022468    null
  base.apk            0x2022a44    null
  base.apk            0x2018b64    null
  base.apk            0x1f3e8d8    null
  base.apk            0x1f78840    null
  base.apk            0x1f7926c    null
  base.apk            0x1f2d0f0    null
  libhwui             0x00035bc    null
   nativePollOnce
   nextLegacy (MessageQueue.java:917)
   next (MessageQueue.java:1029)
   loopOnce (Looper.java:209)
   loop (Looper.java:361)
   main (ActivityThread.java:10336)
   invoke
   run (RuntimeInit.java:675)
   main (ZygoteInit.java:1002)

Thread: main
  libc                0x012188c    mmap
  base.apk            0x20079d0    null
  base.apk            0x20217e8    null
  base.apk            0x2022468    null
  base.apk            0x2022a44    null
  base.apk            0x2018b64    null
  base.apk            0x1f3e8d8    null
  base.apk            0x1f78840    null
  base.apk            0x1f7926c    null
  base.apk            0x1f2d0f0    null
  libhwui             0x00035bc    null
   nativePollOnce
   nextLegacy (MessageQueue.java:917)
   next (MessageQueue.java:1029)
   loopOnce (Looper.java:209)
   loop (Looper.java:361)
   main (ActivityThread.java:10336)
   invoke
   run (RuntimeInit.java:675)
   main (ZygoteInit.java:1002)

On which target platforms have you observed this bug?

Android

Flutter Doctor output

Doctor output
Flutter (Channel stable, 3.35.5, on macOS 15.6.1 24G90 darwin-arm64) [491ms]
    • Flutter version 3.35.5 on channel stable at /Users/user/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ac4e799d23 (5 months ago), 2025-09-26 12:05:09 -0700
    • Engine revision d3d45dcf25
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [1 601ms]
    • Android SDK at /Users/user/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.1.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.0) [1 153ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17A324
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [8ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions