Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
UIPrintInteractionController printingItems not showing up / working

Pretty straightforward...

I consider myself a fairly well-seasoned iOS developer these days, but this one seems like a glaring bug in iOS, unless I missed something.

Please see the code below.

The file paths point to two one-page PDFs.

What shows up is a Print interaction controller with no content to print.

If I instead only do 1 file at a time like this:

pc.printingItem = [NSURL fileURLWithPath:filePath1];

it works like a champ.

What am I missing here?!

UIPrintInteractionController *pc = [UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.orientation = UIPrintInfoOrientationLandscape;
pc.printInfo = printInfo;

pc.printingItems = @[[NSURL fileURLWithPath:filePath1], 
                     [NSURL fileURLWithPath:filePath2]];

[pc presentAnimated:YES completionHandler:completionHandler];

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I had the same issue and solved it by setting the printingItem property with raw data of my PDF file.

// Here is a class I created that works with `UIActivityViewController`,
// feel free to tweak to your needs.

final class CustomActivityViewController: UIActivityViewController {

    init(with filePath: URL, and fileData: Data?) {
        super.init(activityItems: [filePath], applicationActivities: [])
    
        completionWithItemsHandler = { activity, complete, items, error in
        
            if activity == .print {
            
                let printInfo = UIPrintInfo(dictionary: nil)
                printInfo.jobName = filePath.lastPathComponent
                printInfo.outputType = .general
            
                let printer = UIPrintInteractionController.shared
                printer.printingItem = fileData // <-- This is the cure.
                printer.printInfo = printInfo
            
                printer.present(animated: true, completionHandler: nil)
            }
        }
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!