Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda