问题描述
图像没有被 ngx-print 打印出来.我不确定我在这里做错了什么.
HTML
<button type="button" printTitle="PrintVoucher" [useExistingCss]="true"printSectionId="printVoucher" ngxPrint>打印</button>
但是图像在屏幕上可见,但在打印预览部分不可见.
你必须使用绝对路径,而不是相对路径
即你的路径应该是例如
"http://localhost:3000/assets/images/print-logo.png"不是print-logo.png"
例如要获取您当前的基本网址(http://localhost:3000"),您可以使用
让 x = window.location.origin;
Image is not getting printed with ngx-print. I am not sure what am I doing wrong here.
HTML
<button type="button" printTitle="PrintVoucher" [useExistingCss]="true"
printSectionId="printVoucher" ngxPrint>
Print </button>
<div row id="printVoucher" >
<img src="assets/images/logo.png">
</div>
However the image is visible on the screen , but not visible in the print preview section.
you have to use absolute path , Not relative path
ie your path should be for example
"http://localhost:3000/assets/images/print-logo.png"not "print-logo.png"
to know the difference between relative and absolute path check this link
to get your current base Url for example ("http://localhost:3000") you can use
let x = window.location.origin;
这篇关于使用 ngx-print 打印图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!