ezekielelin
ezekielelin

Reputation: 11

Opening a PDF with Preview in Objective-C

I have an application, I wish to click a button and open a PDF that would be saved in the application files.

Upvotes: 0

Views: 867

Answers (2)

bames53
bames53

Reputation: 88155

You can say [[NSWorkspace sharedWorkspace] openFile:pdf_file];

Upvotes: 2

Richard J. Ross III
Richard J. Ross III

Reputation: 55533

You could use this:

system([[NSString stringWithFormat:@"open %@", path_to_my_file] UTF8String]);

This way, if the user likes using another application to open their PDFs, it will open that instead.

Upvotes: 1

Related Questions