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?
You can convert the html to pdf before saving it to ibooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With