图像未使用 ngx-print 打印。我不确定我在这里做错了什么。
HTML
<button type="button" printTitle="PrintVoucher" [useExistingCss]="true"
printSectionId="printVoucher" ngxPrint>
Print </button>
<div row id="printVoucher" >
<img src="assets/images/logo.png">
</div>
但是,图像在屏幕上可见,但在打印预览部分不可见。
最佳答案
必须使用绝对路径,而不是相对路径
即你的路径应该是例如
"http://localhost:3000/assets/images/print-logo.png " 不是“print-logo.png”
to know the difference between relative and absolute path check this link
要获取当前的基本网址,例如(“http://localhost:3000 ”),您可以使用
让 x = window.location.origin;
关于javascript - 使用ngx-print打印图像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56694343/