How to print PDF file already opened in QLPreviewController using print button?

302 views Asked by At

I get binary array then convert it and save in Documents folder and then showed in QLPreviewController. I have seen the right button on the tool bar of QLPreviewController.

I want to print that is in the preview right now. But when i tab error occurs

*** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIDocumentInteractionController.m:960

Also please guide me about printing that document. I have read about UIPrintInteractionController.

1

There are 1 answers

0
Amir iDev On BEST ANSWER

Why this Error occurs because you have set the URL wrong. You are setting url like that;

/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf

Where as UIDocumentationController task URL as:

file://localhost/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf

This minor mistake will made you mad ;)