Use-Case : User navigates to any url on safari page, taps on the share button and can share the pdf file of the safari page through the app. Eg: iBooks, iPrint
Tried solution :
1. Able to get the url link of the safari page on the app and then loading the same url on UIWebview and creating pdf out of it. Problem here is if the url is a user credential based then it would redirect to the login page when loaded on UIWebview.
2. Able to fetch the html string out of safari page on the app and then loading the same html with base url on UIWebview and eventually creating pdf out of it. The problem here is that the html might have some external iFrame sources with different relative path and hence would not load the entire content of the page properly. Also the external links might need some more parameter values along.
3. Open safari, go to any link and tap on share button. Then go to Apple's Print extension which will automatically generate pdf which can be passed to any of the extension apps. The problem here is the sharing mechanism is available from iPhone 6s where 3D Touch is available and we want to add our application as Printer and should be seen as Select Printer option on the Print page. This looks very promising though. I have attached the screen shots for the same.
Targeted OS : iOS - iPad