使用 ngx-print 打印图像的问题 [英] Problem with image printing using ngx-print

查看:56
本文介绍了使用 ngx-print 打印图像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像没有被 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 打印图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆