Ability to print remote content via URI

This commit is contained in:
Sebastián Katzer 2014-09-11 23:14:18 +02:00
parent 6053b1f83a
commit 7cae0fa4a5

View File

@ -155,13 +155,20 @@
[self adjustWebView:page andPrintPageRenderer:renderer]; [self adjustWebView:page andPrintPageRenderer:renderer];
// Set the base URL to be the www directory. if ([NSURL URLWithString:content]) {
NSString* wwwFilePath = [[NSBundle mainBundle] pathForResource:@"www" NSURL *url = [NSURL URLWithString:content];
ofType:nil];
NSURL* baseURL = [NSURL fileURLWithPath:wwwFilePath]; [page loadRequest:[NSURLRequest requestWithURL:url]];
}
else {
// Set the base URL to be the www directory.
NSString* wwwFilePath = [[NSBundle mainBundle] pathForResource:@"www"
ofType:nil];
NSURL* baseURL = [NSURL fileURLWithPath:wwwFilePath];
[page loadHTMLString:content baseURL:baseURL]; [page loadHTMLString:content baseURL:baseURL];
}
controller.printPageRenderer = renderer; controller.printPageRenderer = renderer;
} }