the Markup as pdf is a new options in share sheet in iOS 11, i would to give a button for that action in my UI so that when the user clicks that button the pdf markup view(refer the pic below) shows up.
Thanks in advance
Tap the Camera button or the Document button , then look for the photo or PDF that you want to attach and mark up. Tap the attachment, then tap the gray arrow icon . Tap the Markup button to add your markup. Tap the plus button to add a signature, text, and more.
Change or delete markupOpen the PDF, then tap the Markup icon. Tap any markup to select it. A set of tools and commands also appears, with options including Copy and Delete.
Delete annotations Delete a single annotation: If you're annotating the document, tap the eraser tool, then tap the annotation. Otherwise, tap the annotation, then tap Delete. , then tap Erase All Smart Annotations.
I've been trying to find out a solution for several hours. I presented UIDocumentInteractionController, SFSafariViewController, UIActivityViewController, QLPreviewController.
And for now, there is NO WAY to call Instant Markup programmatically.
The only near solution is to present UIActivityViewController with UIActivityType.markupAsPDF (Documentation link)
func showMenu()
{
if let pdfUrl = Bundle.main.url(forResource: "Martin", withExtension: "pdf") {
let activityController = UIActivityViewController(activityItems: [pdfUrl], applicationActivities:nil)
ctra.excludedActivityTypes = [
UIActivityType.postToFacebook,
UIActivityType.postToTwitter,
UIActivityType.postToWeibo,
UIActivityType.message,
UIActivityType.mail,
UIActivityType.copyToPasteboard,
UIActivityType.assignToContact,
UIActivityType.saveToCameraRoll,
UIActivityType.addToReadingList,
UIActivityType.postToFlickr,
UIActivityType.postToVimeo,
UIActivityType.postToTencentWeibo,
UIActivityType.airDrop,
UIActivityType.openInIBooks,
]
// These activity types shouldn't be excluded
// UIActivityType.print,
// UIActivityType.markupAsPDF
self.present(activityController, animated: true, completion: nil)
}
}
In the bottom line of extension apps, you will see "Create PDF".
P.S.
As you can see following screenshots, Apple uses QLPreviewController. I've tried to present QLPreviewController, but it shows without Instant Markup button. It could be that Apple will provide us the required API later, but I have doubts about it.
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