Git Product home page Git Product logo

Comments (11)

lmsantanam avatar lmsantanam commented on May 16, 2024 3

Hi, in my case, I ended up using this plugin:

https://github.com/stephanrauh/ngx-extended-pdf-viewer

Is originally designed for Angular but adapting to Ionic was not very difficult

from capacitor-docs.

lmsantanam avatar lmsantanam commented on May 16, 2024 1

@muuvmuuv sorry I've only worked with standard URL's to show a PDF that is hosted online, not local files. That "capacitor link" is unknown to me... btw did you try the plugin I suggested?

https://github.com/stephanrauh/ngx-extended-pdf-viewer

If your error is with that plugin I would suggest to look at the issues there, the creator of that plugin is really awesome and helpful

from capacitor-docs.

lmsantanam avatar lmsantanam commented on May 16, 2024

Hi, thanks for creating this, so is there no solution on how to simply open a pdf with an app using capacitor? I've been trying since last week with this and now I'm considering switching back this app to Cordova

from capacitor-docs.

imhoffd avatar imhoffd commented on May 16, 2024

How are you doing this in Cordova?

from capacitor-docs.

lmsantanam avatar lmsantanam commented on May 16, 2024

How are you doing this in Cordova?

I'm not, this is my first time working with pdf files in Ionic. But for Cordova I've found a bit more information. Right now I'm following this tutorial to see if maybe I'm lucky

https://www.youtube.com/watch?v=k2iaGNApM9w

from capacitor-docs.

muuvmuuv avatar muuvmuuv commented on May 16, 2024

Anyone made some progress here? I am also tinkering about it. But I guess opening it in the build in browser and let that one display his own PDF controls is the easisiest solution right now. I would really like to not install 4 cordova plugins do display PDF's.

from capacitor-docs.

muuvmuuv avatar muuvmuuv commented on May 16, 2024

@LuisManuel1983 how did you got it working with Capacitor urls? I mean capacitor://localhost/_capacitor_file..... Here it just says "Unexpected server response (0) while retrieving pdf ---".

from capacitor-docs.

muuvmuuv avatar muuvmuuv commented on May 16, 2024

@LuisManuel1983 I am already using that plugin. I guess it just has something to do with pdj.js trying to parse the url different when having a custom protocol.

from capacitor-docs.

elvisgraho avatar elvisgraho commented on May 16, 2024

Works with Ionic & Capacitor (pdf does not load with live reload when developing, because of CORS, but works fine otherwise)

https://github.com/stephanrauh/ngx-extended-pdf-viewer can use your local capacitor// url to open locally stored files.

      const uriResult = await Filesystem.getUri({
        directory: Directory.Data,
        path: `filename.pdf`,
      });

      // the path to the file
      const path = uriResult.uri;

      // convert to capacitor//
      const localFileURL = Capacitor.convertFileSrc(path);

(you can also get the url with cordova and old ionic plugins)

from capacitor-docs.

buckmower avatar buckmower commented on May 16, 2024

Is there a solution for a React based Ionic App? I'm getting the error:

[Log] PDFJS.express: Development environment detected. This license key is currently registered to {mydomain} (PDFJSDocumentType.js, line 64020, x2)

The problem seems to be that capacitor://localhost isn't {mydomain} and furthermore doesn't qualify as localhost according to PDFJS.

from capacitor-docs.

cyz1901 avatar cyz1901 commented on May 16, 2024

Perhaps we can write a plugin that uses Swift and Kotlin native APIs to display PDF?

from capacitor-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.