Is binary supported?
See original GitHub issueWe have an API endpoint that returns us the binary file ('content-type': 'binary/octet-stream'
) of a PDF. However, when I pass the blob response to the component, several different errors are displayed on the developer’s console:
Error: Invalid XRef stream header
pdf.worker.js:355 at error (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:1256:17)
at XRef_readXRef [as readXRef] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:22222:29)
at XRef_parse [as parse] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:21892:28)
at PDFDocument_setup [as setup] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:30797:17)
at PDFDocument_parse [as parse] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:30686:12)
at http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:40459:28
at Promise (<anonymous>)
at LocalPdfManager_ensure [as ensure] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:40454:14)
at LocalPdfManager.BasePdfManager_ensureDoc [as ensureDoc] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:40406:19)
pdf.worker.js:346 Warning: Indexing all PDF objects
pdf.worker.js:354 Error: Bad FCHECK in flate stream: 120, 253
pdf.worker.js:355 at error (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:1256:17)
at FlateStream (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:2870:23)
at Parser_makeFilter [as makeFilter] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:5734:18)
at Parser_filter [as filter] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:5701:21)
at Parser_makeStream [as makeStream] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:5690:21)
at Parser_getObj [as getObj] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:5358:47)
at XRef_fetchUncompressed [as fetchUncompressed] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:22309:28)
at XRef_fetch [as fetch] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:22272:26)
at XRef_fetchIfRef [as fetchIfRef] (http://localhost:3030/_nuxt/7f662a37670c93fa585a.worker.js:22255:19)
pdf.worker.js:346 Warning: Invalid stream: "Error: Bad FCHECK in flate stream: 120, 253"
The template is very simple:
<template>
<pdf v-bind:src="report" />
</template>
<script>
import axios from 'axios';
import pdf from 'vue-pdf';
const api = axios.create({
baseURL: `https://api.ourdomain.com/v1`,
responseType: 'blob'
});
export default {
components: {
pdf
},
async asyncData(ctx) {
const {params: {id}, query: {uid, rid}} = ctx;
let url = `/report/${id}`;
const params = {
media: 'pdf',
uid, rid
};
const blob = await api.get(url, {params}).then(response => {
return {data: response.data};
});
return {
report: blob
}
}
}
</script>
Pretty sure I’m missing something.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Binary-code compatibility - Wikipedia
Binary-code compatibility (binary compatible or object-code-compatible) is a property of a computer system, meaning that it can run the same executable code ...
Read more >Binary Compatibility - Computerworld
Two computers can be considered binary compatible if they can run the same software without requiring that the application be recompiled. The computers...
Read more >What is binary compatibility in Java? - Stack Overflow
In short, binary compatibility means that when you change your class, you do not need to recompile classes that use it. For example,...
Read more >Binary Compatibility for Linux Distributions | tuxcare.com
Two distinct computing environments are binary compatible if source ... CentOS and Oracle Linux are application binary compatible with RHEL.
Read more >What is a binary file and how does it work? - TechTarget
A binary file is a file whose content is in a binary format consisting of a series of sequential bytes, each of which...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@betacar here is a complete example:
v3.0.1 is the latest version available on npm