question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Openning PDF in iOS

See original GitHub issue

I’m trying to open a PDF file that is local to the device on IOS 12. The PDF doesn’t open but rather an action dialog box opens (attached) instead. Can we open the PDF directly ?

Here is the code I’m using:

     OpenFile.open(report.path,  type: "application/pdf", uti: "com.adobe.pdf");

and pubspec.yaml

 open_file: ^3.2.1

Thanks!

Simulator Screen Shot - iPhone 12 - 2021-05-21 at 13 56 46

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
webnickellcommented, Aug 3, 2021

If you are using a simulator, try it on a real machine

Oh no, we check it on different real IOS devices, this problem is not in simulator.

0reactions
ygotthilfcommented, Sep 2, 2021

The (ugly) workaround I found for the old “.file” files still in cache looks like:

    String path = file.path;

    if (path.endsWith('.file')) {
      final copied = await file.copy(
        path.replaceFirst(RegExp(r'\.file$'), '.pdf'),
      );

      path = copied.path;
    }

    await OpenFile.open(
      path,
      type:  'application/pdf',
      uti:  'com.adobe.pdf',
    );
Read more comments on GitHub >

github_iconTop Results From Across the Web

Read PDF documents in Books on iPhone - Apple Support
In the Books app , you can open and save PDFs that you receive in Mail, Messages, and other apps. Open PDFs in...
Read more >
4 Ways to Read PDFs on an iPhone - wikiHow
1. Tap a link to open the PDF file. PDF files open natively in the Safari app. Tapping a link to a PDF...
Read more >
View PDFs on iPhone or iPad - Ansarada Help & Support
View PDFs on iPhone or iPad · 1. Download the Adobe Acrobat Reader app. · 2. Go to the Left menu. · 3....
Read more >
How to Open PDF on iPhone 13 Free
On your iPhone 13/12/11/X/8/76S/6, locate the PDFelement app and tap on it to open. Next, you will have to open the PDF file...
Read more >
The Best Ways to View PDF Files on an iPhone
The Mail, Safari and iBooks apps preinstalled on the iPhone all allow you to view PDFs on your iPhone. The iBooks app offers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found