question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how can print file via Blob()

See original GitHub issue

Hello AS is see most of the Doc is about how to print a file by its url. But as this issue https://github.com/crabbly/Print.js/issues/316 I decided to download file via blob and then print the file. here is what I have done :

 const file = new Blob([responses.data], { type: "application/pdf" });
 printJS(fille);

but I got the error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
matiasgabrielgarciacommented, Jan 7, 2021

Hi there !

You need to pass an URL.

printJS(URL.createObjectURL(file))
0reactions
crabblycommented, Feb 18, 2021

The open issue related to the filename control is actually #487.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Print PDF from BLOB - javascript - Stack Overflow
I have already solve this using: req.onload = function (event) { var blob ... Try the code below to make sure the .pdf...
Read more >
Print PDF from Blob Using JavaScript | PSPDFKit SDK
Print PDFs from a Blob Using JavaScript. If you want to start printing a document loaded in a Blob , create an object...
Read more >
pdf fetch and print via blob() - CodePen
1. fetch('https://media.readthedocs.org/pdf/flask-cors/latest/flask-cors.pdf').then(function(response) { ; 2. return response.blob(); ; 3. }).then(function(myBlob) ...
Read more >
Blob - The Modern JavaScript Tutorial
We can make a Blob from a typed array using new Blob(...) constructor. We can get back ArrayBuffer from a Blob using blob.arrayBuffer()...
Read more >
Blob.text() - Web APIs - MDN Web Docs
The FileReader method readAsText() is an older method that performs a similar function. It works on both Blob and File objects. There are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found