espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of pdfium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
62 stars 38 forks source link

TypeError: Cannot perform Construct on a detached ArrayBuffer #97

Closed Sikman closed 2 months ago

Sikman commented 2 months ago

When I open the PDF document, go back and then return again with forward arrow to the previously opened document, I receive an error:

TypeError: Cannot perform Construct on a detached ArrayBuffer

../pdfjs-dist/build/pdf.min.js 22:21357 getDataProp ../pdfjs-dist/build/pdf.min.js 22:17057 getDocument ../dart-sdk/lib_external/js_shared/lib/js_util_patch.dart 110:66 callMethod$ ../packages/pdfrx/src/web/pdf.js.dart 71:5 pdfjsGetDocumentFromData ../packages/pdfrx/src/web/pdfrx_web.dart 70:21 ../packages/pdfrx/src/web/pdfrx_web _openByFunc ../dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 ./dart-sdk/lib/async/zone.dart 1661:54 runUnary ./dart-sdk/lib/async/future_impl.dart 162:18 handleValue ./dart-sdk/lib/async/future_impl.dart 838:44 handleValueCallback ./dart-sdk/lib/async/future_impl.dart 867:13 _propagateToListeners ./dart-sdk/lib/async/future_impl.dart 643:3 [_completeToListeners] ./dart-sdk/lib/async/future_impl.dart 713:6 callback ./dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop ./dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop ./dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7

Any ideas?

espresso3389 commented 2 months ago

Please show your code that calls pdfrx.

Sikman commented 2 months ago

Unfortunately, I can't. It is a private code. I retrieve the PDFs via PdfViewer and PdfDocumentRefData, Also, what I have noticed, seems that my Layout is faster then my controller - e.g I can't retrieve at the beginning the number of pages, I need to check first if(controller.isReady ? ) then I can get my data - or to make some interaction with the page(scroll, next page etc.), then the controller is ready. Not sure what can cause these problems

espresso3389 commented 2 months ago

I'm not interested in your actual code. Without you providing any kind of code fragments or something that reproduces the issue, I can't do anything.

espresso3389 commented 2 months ago

Is it really OK for you? If you create some repro code (completely new code that reproduces the same issue), it's very helpful to understand your situation.

Sikman commented 2 months ago

The problem was when I want to open the document, so I am checking the type of the file. Needed to pack my raw data inside of Uint8List.fromList(rawData). It is done. Tnx anyway