如何在UIMarkupTextPrintFormatter中添加图片? [英] How to Add Images in UIMarkupTextPrintFormatter?

查看:117
本文介绍了如何在UIMarkupTextPrintFormatter中添加图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用直接的HTML打印文件,但是,我无法向打印文件中添加图片。

I'm trying to print a file using straight HTML, however, I am having difficulties adding images to the print file.

如何在我要打印的HTML中引用我项目中的图像?是否UIMarkupTextPrintFormatter支持标签?

How can I reference images in my project in the HTML that I want to print? Does the UIMarkupTextPrintFormatter support tags?

推荐答案

这实际上比我想象的要简单:

It's actually much simpler than I thought:

NSString *yourImagePath = [[[NSBundle mainBundle] URLForResource:@"resource" withExtension:@"extension"] absoluteString];

然后您可以将图像路径放在< img> ,它会渲染图像! Voila!

Then you can put the image path in an <img> and it will render the image! Voila!

这篇关于如何在UIMarkupTextPrintFormatter中添加图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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