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

822
Views
html2pdf external image not showing

I have an MVC app utilizing html2pdf to convert html into a PDF document with javascript. The html that is being converted is a customer invoice with an image of their logo. We utilize Azure Blob storage to store our images. Since Azure blob storage is hosted all our images show by placing the URL of where it is located in Azure blob storage.

I have been able to convert the html to a pdf but the external url images are not displaying in the pdf, just a blank space shows up.

I am receiving this error:

Access to image at 'https://blob.core.windows.net/images/a5a1032bf7b3b0ae4f70/profile/2064/Transparent_Logo_Blue.png' 
from origin 'http://localhost:65426' 
has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' 
header is present on the requested resource.

I have enabled cors, enabled cross origin on the img tag. I have tried changin type: 'png' to jpg and jpeg. All with the same errors.

My code:

 function downloadPDF() {

        //var element = document.getElementById('invoice');
        //html2pdf(element);

        // Get the element to print
        var element = document.getElementById('invoice');

        // Define optional configuration
        var options = {
            filename: 'inv_' + $('#InvoiceMaster_InvoiceNumber').val() + '.pdf',
            image: { type: 'png', quality: 0.98 },
            html2canvas: { scale: 2, allowTaint: false, useCORS: true },
            jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
        };

        // Create instance of html2pdf class
        var exporter = new html2pdf(element, options);

        // You can also use static methods for one time use...
        options.source = element;
        options.download = true;
        /*html2pdf.getPdf(options);*/

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

0

May be it´s something related with azure blob access permissions.

I don´t know if it´s your case, but may be that you need to add some information in your header requests as it has been explained on that document.

https://docs.microsoft.com/en-us/rest/api/storageservices/preflight-blob-request

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!