From 7cae0fa4a588309ba281d10e881383943cb3d64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 11 Sep 2014 23:14:18 +0200 Subject: [PATCH] Ability to print remote content via URI --- src/ios/APPPrinter.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ios/APPPrinter.m b/src/ios/APPPrinter.m index ef5020d..9056a66 100755 --- a/src/ios/APPPrinter.m +++ b/src/ios/APPPrinter.m @@ -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; }