Want to download base64 string as PDF and save in my project folder #25692
Unanswered
srpalwaidynamite
asked this question in
Questions and Help
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
@bahmutov Can you please help me. Thanks so much in advance |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to convert base64 string as PDF and download in my project folder
I'm using below code,
//Get the base64String from API response
const base64String =
res.body.completedShipments[0].completedPackages[0].documents[0].image;
// Convert the base64 string to a Blob object
const blob = new Blob([base64String], { type: "application/pdf" });
// Create an object URL for the Blob object

const url = URL.createObjectURL(blob);
// Save the PDF file using cy.downloadFile()
cy.downloadFile(url,'downloads','temp.pdf');
This is throwing me an error saying "Only HTTP(S) protocols are supported"...Is there any other way to work on this. Can you PLEASE help me
Beta Was this translation helpful? Give feedback.
All reactions