gpt4 book ai didi

javascript - 使用 ngx-print 打印图像的问题

转载 作者:行者123 更新时间:2023-11-30 19:28:17 24 4
gpt4 key购买 nike

图像未使用 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>

但是图像在屏幕上可见,但在打印预览部分不可见。

enter image description here

最佳答案

你必须使用绝对路径,而不是相对路径

例如你的路径应该是

"http://localhost:3000/assets/images/print-logo.png "不是“print-logo.png”

to know the difference between relative and absolute path check this link

例如,要获取您当前的基本 Url ("http://localhost:3000 "),您可以使用

让 x = window.location.origin;

关于javascript - 使用 ngx-print 打印图像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56694343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com