1
我使用下面的代码从iOS中的HTML字符串生成PDF。我在创建PDF时似乎失去了任何标签。我已经尝试添加src属性指向设备上的文件以及将base64图像数据放入源中。创建PDF时的HTML中的图像标签
在这里,我创建UIMarkupTextPrinterFormatter:
UIMarkupTextPrintFormatter *fmt = [[UIMarkupTextPrintFormatter alloc]
initWithMarkupText:htmlStringHere];
我htmlStringHere值包含:
<html><head><style>.testClass{color:yellow;font-weight:bold;}</style></head><body><img src="Icon.png" ></img></body>
然后我用一个自定义UIPrintPageRenderer生成PDF。此时,图像已经丢失。其他html元素不会丢失。