espresso3389/pdfrx

PDF displays white pages - Package not working until the restart of the app

Closed this issue · 4 comments

Hello,

I am working on displaying a PDF with multiple links (~30 per pages), however arrived to a specific page the pdfrx does display the next pages into white pages and scrolling back to the previous pages make them white also.

Refreshing the pages makes the pdfrx doesn't displaying anything anymore (not even white pages) (even if it is a different PDF).

Here the error I received when the bug happened :

E/flutter ( 6514): [ERROR:flutter/runtime/dart_isolate.cc(1315)] Unhandled exception:
E/flutter ( 6514): FormatException: Missing extension byte (at offset 21)
E/flutter ( 6514): #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1852:7)
E/flutter ( 6514): #1      Utf8Decoder.convert (dart:convert/utf.dart:349:37)
E/flutter ( 6514): #2      Utf8Codec.decode (dart:convert/utf.dart:63:20)
E/flutter ( 6514): #3      Utf8Pointer.toDartString (package:ffi/src/utf8.dart:49:17)
E/flutter ( 6514): #4      PdfPagePdfium._processAnnotLink (package:pdfrx/src/pdfium/pdfrx_pdfium.dart:820:33)
E/flutter ( 6514): #5      PdfPagePdfium._loadAnnotLinks.<anonymous closure>.<anonymous closure> (package:pdfrx/src/pdfium/pdfrx_pdfium.dart:773:33)
E/flutter ( 6514): #6      using (package:ffi/src/arena.dart:124:31)
E/flutter ( 6514): #7      PdfPagePdfium._loadAnnotLinks.<anonymous closure> (package:pdfrx/src/pdfium/pdfrx_pdfium.dart:743:23)
E/flutter ( 6514): #8      _ComputeParams.execute (package:pdfrx/src/pdfium/worker.dart:77:43)
E/flutter ( 6514): #9      BackgroundWorker._workerEntry.<anonymous closure> (package:pdfrx/src/pdfium/worker.dart:30:17)
E/flutter ( 6514): #10     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
E/flutter ( 6514): #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
E/flutter ( 6514): #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:297:7)
E/flutter ( 6514): #13     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:19)
E/flutter ( 6514): #14     _StreamController._add (dart:async/stream_controller.dart:658:7)
E/flutter ( 6514): #15     _StreamController.add (dart:async/stream_controller.dart:606:5)
E/flutter ( 6514): #16     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

I am sorry I cannot provide you the file due to confidentiality.

My flutter version :

Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (6 weeks ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2

The version I am using :
pdfrx: ^1.0.83

It seems some text data contains invalid UTF-8 bytes. Just adding error handling code will fix the issue.

It seems some text data contains invalid UTF-8 bytes. Just adding error handling code will fix the issue.

#230

Thanks for the merging! Is it possible to gen a new version please or maybe you're already doing it ?

@espresso3389 is it possible to generate a new version since it corrects a bug that can make the package crash or are you waiting for some other soon upcoming commits ?