我正在使用pdfmake,一个很好的 javascript pdf 打印库在我的 angularjs SPA 中生成 pdf。当我只使用文本时,一切正常。pdf 正确显示所有文本。但是当我尝试显示图像时,它对我不起作用。没有错误,没有空的pdf,什么也没发生。也没有404。
这是我现在正在尝试的代码,
var dd = {
content: [
{
image: 'picture13438908025659.jpg'
},
{
text: 'Patient\'s Detail', fontSize: 18, bold: true
},
{
columns: [
{
text: 'Patient\'s ID: ' + $scope.prescription.Patient[0].id, bold: false
},
{
text: 'Name: ' + $scope.prescription.Patient[0].name, bold: false
},
{
text: 'Age: ' + $scope.prescription.Patient[0].age, bold: false
},
{
text: 'Contact: ' + $scope.prescription.Patient[0].contact, bold: false
}
]
},
{
text: 'Address: ' + $scope.prescription.Patient[0].address, bold: false
}
]
}