Question

I have an app that has no main window. It lives in the status bar, and from it I can open various windows. From one of these windows I can print a report.

I am using NSPrintOperation to accomplish this, and it seems to work fine for the most part. The document prints when I click the print button on the print panel.

If I select "Open PDF in preview, it sends it to preview successfully. It will send it as PDF to Mail, etc. The only thing that doesn't work is when I click "Save as PDF". When I do so, the print panel hangs for a few seconds, but nothing happens. The app does become responsive again. If I shift spaces and then shift back again I see some of the controls that should be on the save dialog that should have appeared, Namely the text fields that let me specify the title and author of the new pdf, but no dialog, and ultimately no saved PDF.

Interestingly, I can save the pdf that I send to Preview, from preview. I have tried running the operation both modal'ly and not. I have tried creating the operation instance both with the shared printInfo, and without. In all cases, Save as PDF does not work for me. I am assuming I am missing a step. Does anyone know what might be wrong?

This is on OSX Lion.

Was it helpful?

Solution

I have solved this. I needed to added another entitlement besides printing to my application. The app needs to also have the user selected file read/write access entitlement. This of course makes sense since the dialog will want to ask the user where to save the pdf file once it creates it. Palm, meet forehead. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top