Skip to content

Commit db8af43

Browse files
authored
Merge pull request #45 from tavisbones/uiwebview-removal
Uiwebview removal
2 parents 1cf02e7 + 1dd1ae4 commit db8af43

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

HTMLtoPDF-Demo/HTMLtoPDF-Demo.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
081B228024F7FA1400F172E1 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 081B227F24F7FA1400F172E1 /* WebKit.framework */; };
1011
19A2C6AB1651029B00803EF5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19A2C6AA1651029B00803EF5 /* UIKit.framework */; };
1112
19A2C6AD1651029B00803EF5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19A2C6AC1651029B00803EF5 /* Foundation.framework */; };
1213
19A2C6AF1651029B00803EF5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19A2C6AE1651029B00803EF5 /* CoreGraphics.framework */; };
@@ -23,6 +24,7 @@
2324
/* End PBXBuildFile section */
2425

2526
/* Begin PBXFileReference section */
27+
081B227F24F7FA1400F172E1 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
2628
19A2C6A61651029B00803EF5 /* HTMLtoPDF-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HTMLtoPDF-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2729
19A2C6AA1651029B00803EF5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2830
19A2C6AC1651029B00803EF5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -51,6 +53,7 @@
5153
files = (
5254
19A2C6AB1651029B00803EF5 /* UIKit.framework in Frameworks */,
5355
19A2C6AD1651029B00803EF5 /* Foundation.framework in Frameworks */,
56+
081B228024F7FA1400F172E1 /* WebKit.framework in Frameworks */,
5457
19A2C6AF1651029B00803EF5 /* CoreGraphics.framework in Frameworks */,
5558
);
5659
runOnlyForDeploymentPostprocessing = 0;
@@ -80,6 +83,7 @@
8083
19A2C6A91651029B00803EF5 /* Frameworks */ = {
8184
isa = PBXGroup;
8285
children = (
86+
081B227F24F7FA1400F172E1 /* WebKit.framework */,
8387
19A2C6AA1651029B00803EF5 /* UIKit.framework */,
8488
19A2C6AC1651029B00803EF5 /* Foundation.framework */,
8589
19A2C6AE1651029B00803EF5 /* CoreGraphics.framework */,
@@ -242,7 +246,7 @@
242246
GCC_WARN_ABOUT_RETURN_TYPE = YES;
243247
GCC_WARN_UNINITIALIZED_AUTOS = YES;
244248
GCC_WARN_UNUSED_VARIABLE = YES;
245-
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
249+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
246250
ONLY_ACTIVE_ARCH = YES;
247251
SDKROOT = iphoneos;
248252
TARGETED_DEVICE_FAMILY = "1,2";
@@ -264,7 +268,7 @@
264268
GCC_WARN_ABOUT_RETURN_TYPE = YES;
265269
GCC_WARN_UNINITIALIZED_AUTOS = YES;
266270
GCC_WARN_UNUSED_VARIABLE = YES;
267-
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
271+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
268272
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
269273
SDKROOT = iphoneos;
270274
TARGETED_DEVICE_FAMILY = "1,2";

HTMLtoPDF-Demo/HTMLtoPDF-Demo/HTMLtoPDF-Demo-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<key>CFBundleIdentifier</key>
1212
<string>com.nurves.${PRODUCT_NAME:rfc1034identifier}</string>
1313
<key>CFBundleInfoDictionaryVersion</key>
14-
<string>6.0</string>
14+
<string>8.0</string>
1515
<key>CFBundleName</key>
1616
<string>${PRODUCT_NAME}</string>
1717
<key>CFBundlePackageType</key>

NDHTMLtoPDF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef void (^NDHTMLtoPDFCompletionBlock)(NDHTMLtoPDF* htmlToPDF);
2323
- (void)HTMLtoPDFDidFail:(NDHTMLtoPDF*)htmlToPDF;
2424
@end
2525

26-
@interface NDHTMLtoPDF : UIViewController <UIWebViewDelegate>
26+
@interface NDHTMLtoPDF : UIViewController
2727

2828
@property (nonatomic, copy) NDHTMLtoPDFCompletionBlock successBlock;
2929
@property (nonatomic, copy) NDHTMLtoPDFCompletionBlock errorBlock;

NDHTMLtoPDF.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
// Addons : http://developer.apple.com/library/ios/#samplecode/PrintWebView/Listings/MyPrintPageRenderer_m.html#//apple_ref/doc/uid/DTS40010311-MyPrintPageRenderer_m-DontLinkElementID_7
1414

1515
#import "NDHTMLtoPDF.h"
16+
#import <WebKit/WebKit.h>
1617

17-
@interface NDHTMLtoPDF ()
18+
@interface NDHTMLtoPDF ()<WKNavigationDelegate>
1819

1920
@property (nonatomic, strong) NSURL *URL;
2021
@property (nonatomic, strong) NSString *HTML;
2122
@property (nonatomic, strong) NSString *PDFpath;
2223
@property (nonatomic, strong) NSData *PDFdata;
23-
@property (nonatomic, strong) UIWebView *webview;
24+
@property (nonatomic, strong) WKWebView *webview;
2425
@property (nonatomic, assign) CGSize pageSize;
2526
@property (nonatomic, assign) UIEdgeInsets pageMargins;
2627

@@ -143,8 +144,8 @@ - (void)viewDidLoad
143144
{
144145
[super viewDidLoad];
145146

146-
self.webview = [[UIWebView alloc] initWithFrame:self.view.frame];
147-
webview.delegate = self;
147+
self.webview = [[WKWebView alloc] initWithFrame:self.view.frame];
148+
webview.navigationDelegate = self;
148149

149150
[self.view addSubview:webview];
150151

@@ -155,7 +156,7 @@ - (void)viewDidLoad
155156
}
156157
}
157158

158-
- (void)webViewDidFinishLoad:(UIWebView *)webView
159+
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
159160
{
160161
if (webView.isLoading) return;
161162

@@ -191,7 +192,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView
191192

192193
}
193194

194-
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
195+
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
195196
{
196197
if (webView.isLoading) return;
197198

@@ -209,7 +210,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
209210
- (void)terminateWebTask
210211
{
211212
[self.webview stopLoading];
212-
self.webview.delegate = nil;
213+
self.webview.navigationDelegate = nil;
213214
[self.webview removeFromSuperview];
214215

215216
[self.view removeFromSuperview];

iOS-htmltopdf.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "iOS-htmltopdf"
3-
s.version = "1.0.3"
3+
s.version = "1.1.0"
44
s.summary = "This class enables simple URL-based PDF creation."
55
s.description = "Pages are created the exact same way they would be if the user printed the content on an iOS device (very similar as well as OS X print output)."
66
s.homepage = "https://github.com/iclems/iOS-htmltopdf"

0 commit comments

Comments
 (0)