iOS 9
has a new built-in UIActivity
of UIActivityTypeOpenInIBooks
. It's in the default list of activities in the UI and in header file but I've not been able to find any API documentation for it (yet).
It appears that UIActivityTypeOpenInIBooks
will create a PDF in iBooks just fine if you include UIImages in your UIActivityViewController
items or return them in your UIActivityItemProvider
.
However I'd like to create a PDF
with an HTML page containing text and images like Safari does. But I can't seem to find a way to pass the HTML to UIActivityTypeOpenInIBooks
in an acceptable way.
I've tried passing the HTML as a String, NSData
and NSURL
of a file. I've also tried returning an UIMarkupTextPrintFormatter which works fine for printing but not for UIActivityTypeOpenInIBooks
.
Providing an HTML string or the UIMarkupTextPrintFormatter both result in the following errors:
2015-09-08 11:35:46.392 MyApp[4599:1492484] ERROR: attempting to save to URL with no printing source (formatter/renderer) set
2015-09-08 11:35:46.393 MyApp[4599:1492484] FAILED! due to error in domain UIPrintErrorDomain with error code 4
Has anyone gotten this working?
在将html保存到ibooks之前,您可以将html转换为pdf。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.