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

282
Views
Failed to load PDF but can see the data

I am getting this error that Chrome failed to load the PDF document. I can see the content of the data is the console window so I have the data being returned I just not sure why it will not display? If I File.WriteAllBytes to disk it will open fine so it maybe something with the creating the new Blob

Failed to load PDF document.

Debugger

ts code

 printItems(versionKeys: string[]): JQueryPromise<any> {
        console.log('printItems');
        $.ajax({
            type: "post",
            contentType: "application/json",
            data: JSON.stringify(versionKeys),
            url: this.apiUrls.PrintTemplates,
            success: function (data, status, xhr) {
                console.log('printItems');
                console.log(data);
                let blob = new Blob([data.Content], { type: data.ContentType });
                var url = URL.createObjectURL(blob);
                console.log(url);
                window.open(url);
                console.log('success');
            }
        });

        return;
    }

Error

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I converted the base64 string to a bytes

  var binary_string = window.atob(data.Content)
  var len = data.Content.length;
  var bytes = new Uint8Array(len);
  for (var i = 0; i < len; i++) {
      bytes[i] = binary_string.charCodeAt(i);
  }
  let blob = new Blob([bytes.buffer], { type: data.ContentType })

  var url = URL.createObjectURL(blob);

  window.open(url);
about 4 years ago · Juan Pablo Isaza Report
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!