我试图将BMP图像(编码为base64字符串)放入PDF中,但它失败并显示错误Uncaught Error: Unknown image format
。我知道图像格式正确,因为它正确加载纯HTML:
<img src="data:image/bmp;base64,THEIMAGEINBASE64">
JSFiddle of the HTML-only image here
但是当加载到pdfmake中时如此:
var docDefinition = {
content: [{
image: 'data:image/bmp;base64,THEIMAGEINBASE64'
}]
};
pdfMake.createPdf(docDefinition).download('my.pdf');
...失败(JSFiddle here)。