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

dev working fine after build spa and publishing to server broke #121

Open
pietroestrada opened this issue Jun 29, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@pietroestrada
Copy link

`export function pdf (resp) {
const myPromise = new Promise((resolve, reject) => {
const blob = new Blob([resp.data], { type: resp.data.type })
let url = (window.URL || window.webkitURL || window || {}).createObjectURL(blob)
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onreadystatechange = (() => {
if (xhr.readyState === 4 && xhr.status == 200) {
resolve((window.URL || window.webkitURL || window || {}).createObjectURL(xhr.response))
// now url is ready
}
})
xhr.send()
})

return myPromise
}`

@itokia
Copy link

itokia commented Jun 30, 2022

Hello, I would like to know if you have found a solution to your problem because I am in the same situation as you.

I do so.

const blob = new Blob([response.data], {type: "application/pdf;charset-UTF-8"})
const url = window.URL.createObjectURL(blob)
pdfSrc.value = url
<q-pdfviewer
    v-if="pdfSrc"
    :src="pdfSrc"
    type="html5"
  />

And my controller :

$file = stream_get_contents($document->getPj());

return new Response($file, 200, array(
          'Content-Type' => "application/octet-stream",
           'Content-Length' => $document->getSize(),
 ));

@nucle nucle added the bug Something isn't working label Oct 22, 2022
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