NSString* pathToHtml = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
[PTConvert convertOfficeToPDF:pathToHtml completion:^(NSString *pathToPDF) {
@try {
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString* newDoc = [documentsDirectory stringByAppendingPathComponent:@"test.pdf"];
[[NSFileManager defaultManager] copyItemAtPath:pathToPDF toPath:newDoc error:Nil];
docToOpen = [[PTPDFDoc alloc] initWithFilepath:pathToPDF];
[pdfViewCtrl SetDoc:docToOpen];
}
@catch (NSException *e) {
NSLog(@"Could not open document due to exception %@:%@", e.name, e.reason);
return;
}
}];