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

PlatformException opening normal PDF #559

Open
enricobenedos opened this issue Feb 5, 2025 · 1 comment
Open

PlatformException opening normal PDF #559

enricobenedos opened this issue Feb 5, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@enricobenedos
Copy link

Describe the bug
Unable to show/open a simple PDF, common PDF readers simply open it.

To Reproduce
Steps to reproduce the behavior:

import 'package:flutter/material.dart';
import 'package:pdfx/pdfx.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late PdfController _pdfController;

  @override
  void initState() {
    super.initState();

    _pdfController = PdfController(
      document: PdfDocument.openAsset('assets/20220520_1827_IT.pdf'),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: PdfView(controller: _pdfController),
    );
  }
}

Expected behavior
Simply show the PDF.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: iPhone 16 Pro
  • OS: iOS 18.2

20220520_1827_IT.pdf

Image

@enricobenedos enricobenedos added the bug Something isn't working label Feb 5, 2025
@mplgn
Copy link

mplgn commented Feb 15, 2025

Same exact issue here. I have tried numerous PDFs from various sources, some open and some do not.

I confirmed that the PDF posted by @enricobenedos results in the PlatformException in my app as well.

Not sure if it's relevant, but here are the details of various PDFs that opened (green) or generated the PlatformException (red). It seems like pdfs generated by later versions of the Adobe PDF Library are the ones that won't open.

Also: this exception only occurs in iOS; the package works correctly in Android.

Image Image Image Image Image Image

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