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];
// Set the base URL to be the www directory.
NSString* wwwFilePath = [[NSBundle mainBundle] pathForResource:@"www"
ofType:nil];
NSURL* baseURL = [NSURL fileURLWithPath:wwwFilePath];
if ([NSURL URLWithString:content]) {
NSURL *url = [NSURL URLWithString:content];
[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;
}