airprint

Resize UIImage for UIPrintInteractionController

∥☆過路亽.° 提交于 2021-01-27 06:59:34
问题 I'm currently working on a possibility to print the content of a view via Airprint. For this feature I'm creating a UIImage from the view and send it to UIPrintInteractionController. The problem is that the image is resized to the full resolution of the paper and not it's original size (approx. 300x500px). Does anybody know how to create a proper page from my image. Here is the code: /** Create UIImage from UIScrollView**/ -(UIImage*)printScreen{ UIImage* img = nil;

iPad/iPhone — printing directly to a network printer without airprint popover

三世轮回 提交于 2020-01-30 23:14:27
问题 I've developing an iPad/iPhone application that requires that I print out a receipt on a network printer when I finish a transaction. I've managed to get airprint functionality working to some extent in that I can get the UIPrintInteractionController popover to appear appropriately, click the "Print" button and then view the results in the Printer Simulator. Because of the requirements of my application, I'm hoping to skip the popover step and automatically print the receipt when I close the

UIPrintErrorDomain error 4 on printing with UISimpleTextPrintFormatter

泄露秘密 提交于 2020-01-25 03:48:26
问题 I have the following codes to print a simple text. I'm using HP Officejet 4630 series. But I'm getting UIPrintErrorDomain error 4 as well as error 3. Any idea why? UIPrintInfo *pi = [UIPrintInfo printInfo]; pi.outputType = UIPrintInfoOutputGeneral; pi.jobName = @"test"; UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; pic.printInfo = pi; UISimpleTextPrintFormatter *formatter = [[UISimpleTextPrintFormatter alloc] initWithText:@"testing 123"]; formatter

How to pass a password to UIPrintInteractionController when using AirPrint to print a locked pdf?

我怕爱的太早我们不能终老 提交于 2019-12-23 05:46:15
问题 I would like to use AirPrint to print a locked pdf At iOS, and I know the password, and I would like to know if there is a way to pass the password to the UIPrintInteractionController when I use it to print? Because I don't want to use CGPDFDocumentUnlockWithPassword to unlock the pdf and draw every page. 回答1: I found it is not necessary to pass the password when using AirPrint.once you unlocked the pdf use CGPDFDocumentUnlockWithPassword.You got a CGPDFDocumentRef,declare a sub class from

Unable to display printer options with AirPrint

梦想与她 提交于 2019-12-23 01:18:10
问题 I want to add AirPrint functionality to my iPad application I have been trying to display printer ontions described in Apple's Drawing and Printing Guide I have toolbar and UIBarButtonItem *printButton . In controller I receive onPrintClick and try to display printer options by such code: UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; [controller setDelegate:self]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [controller

UIPrintInteractionController presentFromRect issue

故事扮演 提交于 2019-12-22 00:44:02
问题 Im showing the AirPrint options from a UIButton using the presentFromRect method, everything is working as expected, but if i keep pressing the button fast enough my app crashes with EXC_BAD_ACCESS, probably because of the popover not being release. Im using Xcode 4.2 with ARC enabled. Any help would be great! Update 2: The problem only occur on iOS 5 simulator, iPad 4.3 simulator works as expected. Update: Here is the real problem: * Terminating app due to uncaught exception

How to Add Images in UIMarkupTextPrintFormatter?

拥有回忆 提交于 2019-12-21 07:18:11
问题 I'm trying to print a file using straight HTML, however, I am having difficulties adding images to the print file. How can I reference images in my project in the HTML that I want to print? Does the UIMarkupTextPrintFormatter support tags? 回答1: It's actually much simpler than I thought: NSString *yourImagePath = [[[NSBundle mainBundle] URLForResource:@"resource" withExtension:@"extension"] absoluteString]; Then you can put the image path in an <img> and it will render the image! Voila! 回答2: I

AirPrint contents of a UIView

做~自己de王妃 提交于 2019-12-21 05:06:28
问题 I'm trying to set up printing through an iPad app, where clicking Print will print a view with all of its contents. Here's what I've tried (pulled together from a few examples online): // This is the View I want to print // Just a 200x200 blue square var testView = UIView(frame: CGRectMake(0, 0, 200, 200)) testView.backgroundColor = UIColor.blueColor() let printInfo = UIPrintInfo(dictionary:nil)! printInfo.outputType = UIPrintInfoOutputType.General printInfo.jobName = "My Print Job" // Set up

iOS print without allowing UIPrintInteractionController to appear

你说的曾经没有我的故事 提交于 2019-12-17 11:08:17
问题 I am researching a potential app for a client, and I had a question I wasn't able to find the answer on. What I would like to do is print automatically, without having the UIPrintInteractionController get displayed. An important point I should make is this will not be a production app. I know that otherwise this could violate the user's privacy to just print without the user's consent, but again this will not be a public app on the App Store. One app I found that seems to be able to this is

How to access the UIPrintInteractionController class with NativeScript

僤鯓⒐⒋嵵緔 提交于 2019-12-13 07:37:20
问题 I'm trying to implement AirPrint printing and need to instantiate UIPrintInteractionController . However, I can't seem to get it to find the class. How can I access this UIKit class from NativeScript? function findPrinter() { var printController = UIPrintInteractionController.new(); console.log(printController); } exports.findPrinter = findPrinter; 回答1: Use the following syntax for your case : function findPrinter() { var printController = UIPrintInteractionController; console.log