Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:36:35+00:00 2026-06-13T02:36:35+00:00

I need a way to force the selected Printer to the UIPrintInteractionController when it’s

  • 0

I need a way to force the selected Printer to the UIPrintInteractionController when it’s presented, using an already known printerId.

NOTE: To make tests I’m using Printopia installed on my “MacBook Pro” that shares the “Printer”

I’ve made this test:

-(IBAction)print:(id)sender
{
 UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];

 UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
      NSLog(@"Selected Printer ID: %@",printController.printInfo.printerID);      
  };

 NSString* path = [[NSBundle mainBundle] pathForResource:@"TestImage" ofType:@"png"];
 NSURL* imageURL = [NSURL fileURLWithPath:path isDirectory:NO];

 UIPrintInfo *printInfo = [UIPrintInfo printInfo];
 printInfo.outputType = UIPrintInfoOutputPhoto;
 printInfo.jobName = @"Image print";
 controller.printInfo = printInfo;

 controller.printingItem = imageURL;

 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
 {
    [controller presentFromBarButtonItem:self.printButton animated:YES completionHandler:completionHandler];  // iPad
 }
 else
 {
     [controller presentAnimated:YES completionHandler:completionHandler];  // iPhone
 }
}

When the print is done, the app logs following Printer ID:

\032Printer\032@\032MacBook\032Pro._ipp._tcp.local.

I want to override the printer so I supposed to do in this way:

UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.printerId = @"\032Printer\032@\032MacBook\032Pro._ipp._tcp.local.";
controller.printInfo = printInfo;

But for some reason it doesn’t work, the UIPrintInteractionController don’t select the printer as expected, but the printer is shown in the printer list.

I guess the problem is the strange chars present in the Printer ID.

Anyone knows how the printInfo.printerId is encoded and how to manually set it?

If I store the NSString* printerId into an ivar and sets it again on next print action it works, but I cannot force a default printer by printer Id by hand.


btw: Obviously, if the printer is not available/reachable, I know that cannot be selected …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:36:36+00:00Added an answer on June 13, 2026 at 2:36 am

    In order for you to set the default printer programmatically, you only need to set the printerID of the printInfo to ._ipp._tcp.local. The printerName should be exactly the same as how it is being displayed in the list of printers in the UIPrinterInteractionController popover. For example for a printer that is being displayed as LANIERCOLOR315 [00:80:A3:95:2D:41], the printerID is LANIERCOLOR315 [00:80:A3:95:2D:41]._ipp._tcp.local. You do not have to encode the special characters. The framework will do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a way using the Win32 API to force shutdown my machine. I
I need a way to force a read more type effect using jquery. I
I need a way to force calling a constant version of member function. I'm
I need a way to force a branch in TFS to update itself to
I need to find a way to force Apache to ask users for credentials
Is there a way to force a cucumber scenario to fail? I need to
Topic says it. Short version: I need a way to force a refresh of
I need a way to force the orientation back to portrait on rotate. The
Is there any way to force an update of software using RunOnce, without having
I need a way to change the specific value of a column of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.