PDFMake: Uncaught (in promise): Invalid image: Error: Unknown image format

Viewed 408

I am getting the error when generating the PDF with base64 images using pdfmake in angular. In the content array sent to pdfmake. I see that the base64 images are converted into a format "$$pdfmake$${number} " and the other base64 images are still as base64. Not sure why the images are not rendered and why I am getting the error. The same code is working for low number of images, but when I give more number of images for the pdf it is throwing the error.

Error:

Uncaught (in promise): Invalid image: Error: Unknown image format. Images dictionary should contain dataURL entries (or local file paths in node.js)

1 Answers

it would be nice to see what code you've tried so far but if I had to guess, I'd say that your base64 encoded images aren't in the good format:

As seen in pdfmake's documentation, you can only use JPEG and PNG.

Related