<分区>
我如何将我的 Xcode 项目中存在的图像添加到 HTML 字符串中以打印输出。
我已经尝试了以下代码,但图像没有打印出来,而是 PDF 中出现了一个空白框。
-(NSString *)prepareHTMLText {
NSMutableString *body = [NSMutableString stringWithString:@"<!DOCTYPE html><html><body>"];
[body appendString:@"<h2>Ingredients</h2>"];
[body appendFormat:@"<p>%@ %@</p>", @"text", @"TEStText"];
// [body appendFormat:@"<img src=\"%@\" alt=\"\" height=\"100\" width=\"100\"/>",[[NSBundle mainBundle] pathForResource:@"edit" ofType:@"png"]];
[body appendFormat:@"<img src=\"%@\"/>",[UIImage imageNamed:@"edit.png"]];
[body appendString:@"</body></html>"];
return body;
}
我正在按照上面的方式输出