Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PDF] PdfDocument.dispose crash #129

Closed
kinex opened this issue May 21, 2020 · 3 comments
Closed

[PDF] PdfDocument.dispose crash #129

kinex opened this issue May 21, 2020 · 3 comments

Comments

@kinex
Copy link

kinex commented May 21, 2020

If I draw an image to PDF and finally try to dispose the PdfDocument, the following crash happens:

I/flutter (18810): Unsupported operation: Cannot clear a fixed-length list
�[38;5;244mI/flutter (18810): #0      FixedLengthListMixin.clear  (dart:_internal/list.dart:58:5)�[39;49m
�[38;5;248mI/flutter (18810): #1      _PdfStream.dispose�[39;49m
�[38;5;248mI/flutter (18810): #2      _PdfMainObjectCollection._dispose�[39;49m
�[38;5;248mI/flutter (18810): #3      _PdfCrossTable._dispose�[39;49m
�[38;5;248mI/flutter (18810): #4      PdfDocument.dispose�[39;49m

Here is how I get the image:

  Future<Uint8List> _getPngScreenShotBytes() async {
    final boundary = _previewContainer.currentContext.findRenderObject()
        as RenderRepaintBoundary;
    final image = await boundary.toImage(pixelRatio: 1);
    final byteData = await image.toByteData(format: ImageByteFormat.png);
    final pngBytes = byteData.buffer.asUint8List();
    return pngBytes;
  }

And code for drawing the image:

  void drawImage(Uint8List imageData, Rect rect) {
    final PdfBitmap image = PdfBitmap(imageData);
    _currentPage.graphics.drawImage(image, rect);
  }

syncfusion_flutter_pdf: ^18.1.53-beta
Flutter 1.17.1

@AnandJayachithra
Copy link

Hi Kinex,

The reported issue “Dispose is not working while drawing screen shot image taken by flutter mobile application” is confirmed as defect. The fix for this issue will be available in next weekly patch release scheduled on 26th May 2020.

Feedback: https://www.syncfusion.com/feedback/14627/dispose-is-not-working-while-drawing-screen-shot-image-taken-by-flutter-mobile

With Regards,
Anand

@AnandJayachithra
Copy link

Hi Kinex,

The fix has been included in the latest weekly patch release with version 18.1.54-beta. Kindly try this in your end and let us know if you need any further assistance.

With Regards,
Anand

@kinex
Copy link
Author

kinex commented May 27, 2020

Hi Anand,

Yes I can confirm it works now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants