javascript - 使用 ngx-print 打印图像的问题
问题描述
使用 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”
例如,要获取当前的基本 URL(“ http://localhost:3000 ”),您可以使用
让 x = window.location.origin;
推荐阅读
- postgresql - 通过其 pq.StringArray 属性查询 GORM 数据库
- python - seaborn 分布图中的随机空格/条
- javascript - 如何使用 ang-jsoneditor(Angular 中的 JSON 编辑器)实现自动完成
- android - Android - 尝试使用 Facebook SDK 登录时出错
- sql - 替换 Access 中的字符
- powershell - 在 powershell BITS 传输中使用 URL 变量
- git - Azure Git 存储库将组添加到安全性
- java - 如何在android中获取屏幕/电话时间?
- css - 最好在 CSS 的末尾对类似的媒体查询进行分组,还是在 CSS 中将它们分开?
- html - 当它是文本元素时,我怎么能将元素与其内容分开并改变它们的单独大小,而不是当它是图像时?