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

Rendering Page crashes on iOS #29

Closed
Bendix20 opened this issue Feb 13, 2020 · 4 comments
Closed

Rendering Page crashes on iOS #29

Bendix20 opened this issue Feb 13, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Bendix20
Copy link

Describe the bug
When I try to render a PDF page the App crashes on an iOS device. There is no Exception, only the message :
"Lost connection to device.
Bad state: No element
Bad state: No element
Exited (sigterm)".

On Android this is working fine.

To Reproduce
The App is crashing in line 6

void main() async {
  try {
  WidgetsFlutterBinding.ensureInitialized();
    final document = await PDFDocument.openAsset('assets/hello.pdf');
    final page = await document.getPage(1);
    final pageImage = await page.render(width: page.width, height: page.height);
    await page.close();
    runApp(
      MaterialApp(
        home: Scaffold(
          body: Center(
            child: Image(
              image: MemoryImage(pageImage.bytes),
            ),
          ),
        ),
        color: Colors.white,
      )
    );
  } on Exception catch (error) {
    print(error);
  }
}
@Bendix20 Bendix20 added the bug Something isn't working label Feb 13, 2020
@SergeShkurko

This comment has been minimized.

@SergeShkurko

This comment has been minimized.

@kcruzat
Copy link

kcruzat commented Feb 26, 2020

Got the same issue to on iOS. It's because backgroundColor is a mandatory parameter in the page.render call. It doesn't have a default value too. I guess it works on Android fine without it.

@Bendix20
Copy link
Author

@kcruzat Thats it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants