0

I'm trying to put a BMP image (encoded as a base64 string) into a PDF, however it is failing with the error Uncaught Error: Unknown image format. I know the image is formatted correctly because it loads in pure HTML correctly like so:

<img src="data:image/bmp;base64,THEIMAGEINBASE64">

JSFiddle of the HTML-only image here

But when loading into pdfmake like so:

var docDefinition = {
    content: [{
        image: 'data:image/bmp;base64,THEIMAGEINBASE64'
    }]
};
pdfMake.createPdf(docDefinition).download('my.pdf');

...it fails (JSFiddle here).

mulllhausen
  • 4,225
  • 7
  • 49
  • 71
  • According to [the documentation](http://pdfmake.org/#/gettingstarted), only "JPEG and PNG formats are supported." – Jongware Jun 21 '16 at 08:43
  • Good find, thanks. The doco says: **Images** _This is simple. Just use the { image: '...' } node type. JPEG and PNG formats are supported._ – mulllhausen Jun 22 '16 at 04:45

1 Answers1

0

PDFMake only accepts JPEG and PNG

l -_- l
  • 618
  • 4
  • 15