No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    @quasar/qpdfviewer v1.0.0-beta.2 Release!

    [v1] App Extensions
    3
    6
    713
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Hawkeye64
      Hawkeye64 last edited by

      https://github.com/quasarframework/app-extension-qpdfviewer/releases/tag/v1.0.0-beta.2

      • update dependencies
      • fix: issue with .git in npm package
      1 Reply Last reply Reply Quote 0
      • R
        rconstantine last edited by

        Is there a way to instead of passing a URL to the component, to pass the file itself, maybe as a blob? The files in my case all live locally on a server and are not accessible via the client. I have an API endpoint where I can request the file and it gets sent back to the client. Presently, I’m forcing a download, but it would be cooler to display it using this extension.

        1 Reply Last reply Reply Quote 0
        • R
          rconstantine last edited by

          If you’re curious, this is how I’m presently getting the files:

          fetchPDF (payload) {
                this.$axios.post('/inpatientPDFs/snr/download', payload, { responseType: 'blob' }).then(res => {
                  // console.log('am i downloading?', res)
                  const blob = new Blob([res.data], { type: res.data.type })
                  const url = window.URL.createObjectURL(blob)
                  const link = document.createElement('a')
                  link.href = url
                  const contentDisposition = res.headers['content-disposition']
                  let fileName = 'unknown'
                  if (contentDisposition) {
                    const fileNameMatch = contentDisposition.match(/filename="(.+)"/)
                    if (fileNameMatch.length === 2) {
                      fileName = fileNameMatch[1]
                    }
                  }
                  // let fileName = payload.reportName
                  link.setAttribute('download', fileName)
                  document.body.appendChild(link)
                  link.click()
                  link.remove()
                  window.URL.revokeObjectURL(url)
                }).catch(err => {
                  console.log('or do i have an error?', err) // TODO beef up this
                  this.$q.notify({ message: 'Error downloading PDF', type: 'negative', textColor: 'white', color: 'negative', icon: 'error', closeBtn: 'close', position: 'top' })
                })
              }
          
          1 Reply Last reply Reply Quote 0
          • R
            rconstantine last edited by

            Never mind. I got it. I just use the ```const url = window.URL.createObjectURL(blob)`` line and assign it to :src in the q-pdfviewer.

            I also put the q-pdfviewer inside a q-dialog and show/hide it based on other things. Thanks for the module, @Hawkeye64 !

            1 Reply Last reply Reply Quote 0
            • Hawkeye64
              Hawkeye64 last edited by

              @rconstantine This is good to know! Thanks for the info. ❤

              1 Reply Last reply Reply Quote 0
              • Q
                QuaSam last edited by QuaSam

                QPdfViewer is a great module, thanks. When added to the application, however, a large number of files were added to the statics folder. Can these be safely removed - which items within statics are required, and which can be deleted? Thanks

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post