Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Upload PDF file as BLOB and downloading as PDF again

I'm am trying to upload a pdf file, convert it to a BLOB and download again as a pdf file. At the moment I get no errors but when I download the file I get a blank pdf with what looks like a corrupted file name.

I am saving the BLOB in the pdfFile vairable.

<input  type="file"
        @change="onNewFileUpload($event)">
async onNewFileUpload($event) {

      const file = $event.target['files'][0];
      const fileReader = new FileReader();

      const self = this;
      fileReader.onload = function() {
        pdfFile =  new Blob([fileReader.result], { type: "application/pdf" })
      }

      fileReader.readAsText(file);
},
<button
  @click="downloadPdfFile()"
  class="btn btn-success">Download pdfFile</button>
downloadBOBSCertificate() {
      const link = document.createElement('a');
      // create a blobURI pointing to our Blob
      // link.href = pdfFile;
      link.href = URL.createObjectURL(pdfFile);
      link.download = 'test.pdf';
      // some browser needs the anchor to be in the doc
      document.body.append(link);
      link.click();
      link.remove();
      // in case the Blob uses a lot of memory
      setTimeout(() => URL.revokeObjectURL(link.href), 7000);
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!