You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a PdfDocument in memory, there is not a good way to use it with the PdfViewer.
PdfViewer should support direct rendering a PdfDocument rather than forcing the use of a PdfDocumentRef + PdfStore.
You can use the PdfStore.load method to return a PdfDocument as a PdfDocumentRef, but the magic dispose of PdfDocumentRef will get in the way and prevent you from reusing the PdfDocument:
@overridevoidremoveListener(VoidCallback listener) {
_listeners.remove(listener);
if (_listeners.isEmpty) {
dispose();
}
}
As soon as the viewer disposes, the reference will dispose itself, breaking the PdfDocument. Dispose should not be automatically called by the removeListener call, the reference should only be disposed when dispose is called manually. If you use PdfStore.load to try to manage the lifecycle of the document on your own, this forces you to add a dummy listener just to prevent it from being disposed if you need to reuse the reference later.
The text was updated successfully, but these errors were encountered:
Basically, PdfDocumentRef is introduced to keep the "same" instance between password trials (without valid password, PdfDocument cannot be obtained). If we do that without such mechanism, it's very difficult to deal with async PdfDocument creation process with password trials.
Anyaway, for your purpose, I just added PdfViewer.documentRef that directly accepts PdfDocumentRef.
If you have a PdfDocument in memory, there is not a good way to use it with the PdfViewer.
PdfViewer should support direct rendering a PdfDocument rather than forcing the use of a PdfDocumentRef + PdfStore.
You can use the PdfStore.load method to return a PdfDocument as a PdfDocumentRef, but the magic dispose of PdfDocumentRef will get in the way and prevent you from reusing the PdfDocument:
As soon as the viewer disposes, the reference will dispose itself, breaking the PdfDocument. Dispose should not be automatically called by the removeListener call, the reference should only be disposed when dispose is called manually. If you use PdfStore.load to try to manage the lifecycle of the document on your own, this forces you to add a dummy listener just to prevent it from being disposed if you need to reuse the reference later.
The text was updated successfully, but these errors were encountered: