Giter Club home page Giter Club logo

Comments (10)

hawkeye64 avatar hawkeye64 commented on July 23, 2024 2

This is a great idea! Hoping PDF.js supports being run in Electron, as that would be great.
❤️ Thanks for letting me know about this library.

from app-extension-qpdfviewer.

SmellydogCoding avatar SmellydogCoding commented on July 23, 2024 1

I believe I've found a solution. I used this to implement pdfvuer, but hopefully it will solve the dreaded "referenceError: window is not defined" in other libraries using PDF JS.

Add this to the build section of your quasar.conf.js:

build: {
  chainWebpack (chain) {
    chain.output.globalObject('this')
  }
}

from app-extension-qpdfviewer.

hawkeye64 avatar hawkeye64 commented on July 23, 2024 1

added in v1.0.0-beta.4
@rconstantine PDFJS does not do blobs, but now you can decide which rendering engine to use. So, still available when type="html5".

from app-extension-qpdfviewer.

yusufkandemir avatar yusufkandemir commented on July 23, 2024

@hawkeye64 judging from the existence of

How to Build a PDF Viewer with Electron and PDF.js

and

Electron-PDF-Viewer

PDF viewer, created using Electron framework and PDF.js

I think I can say it must work on Electron.

from app-extension-qpdfviewer.

SmellydogCoding avatar SmellydogCoding commented on July 23, 2024

I would really love to see this as well. Having to rely on end users having the right apps (mobile) or extensions installed, or having to build a separate viewer for Electron kinda defeats Quasars purpose of deploying to multiple platforms from a single code base.

I've used pdfvuer with VueJS but I can't get it working with Quasar. I think there is a problem with PDF JS and the Window object but I'm not sure.

from app-extension-qpdfviewer.

hawkeye64 avatar hawkeye64 commented on July 23, 2024

I started investigating this as a possible solution. Hope to have a remedy soon.

from app-extension-qpdfviewer.

rconstantine avatar rconstantine commented on July 23, 2024

@hawkeye64 , I hope as you make the change that you can retain support for blobs per: https://forum.quasar-framework.org/topic/3551/quasar-qpdfviewer-v1-0-0-beta-2-release

Thanks!

from app-extension-qpdfviewer.

danicholls avatar danicholls commented on July 23, 2024

Just noting the release said it was tested on SPA, SSR, and Electron. Will Cordova be included?

from app-extension-qpdfviewer.

hawkeye64 avatar hawkeye64 commented on July 23, 2024

@danicholls If you are using Cordova, you are welcome to test. Those are just the three I was able to do quickly. In truth, I have never done a cordova app. I should learn, so I can test that as well.

from app-extension-qpdfviewer.

dev-steverob avatar dev-steverob commented on July 23, 2024

I have tested and PDFJS does seem to work with blobs? I'm creating PDF's on the fly using jsPDF and outputting as a blob and then viewing with your plugin and view type=pdfjs so I get the better functionality.

HTML

<q-pdfviewer
  v-model="show"
  :src="pdf"
  type="pdfjs"
  content-class="fit container"
  inner-content-class="fit container"
/>

SCRIPT

pdfOutput () {
  var doc = new JsPDF()
  let address = [
    this.start.COMPANY_NA,
    this.start.SITE_ADDRE,
    this.start.SITE_ADDR2,
    this.start.SITE_CITY,
    this.start.SITE_POSTC
  ]
  doc.text(address, 15, 15)

  let pdf = doc.output('blob', { filename: 'pdfTest.pdf' })
  this.pdf = window.URL.createObjectURL(pdf)
}

from app-extension-qpdfviewer.

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.