File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ typedef void (^NDHTMLtoPDFCompletionBlock)(NDHTMLtoPDF* htmlToPDF);
18
18
@protocol NDHTMLtoPDFDelegate <NSObject >
19
19
20
20
@optional
21
+ - (void )HTMLtoPDFDidSucceed : (NDHTMLtoPDF*)htmlToPDF withData : (NSData *)data ;
21
22
- (void )HTMLtoPDFDidSucceed : (NDHTMLtoPDF*)htmlToPDF ;
22
23
- (void )HTMLtoPDFDidFail : (NDHTMLtoPDF*)htmlToPDF ;
23
24
@end
Original file line number Diff line number Diff line change @@ -175,14 +175,19 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView
175
175
[render setValue: [NSValue valueWithCGRect: printableRect] forKey: @" printableRect" ];
176
176
177
177
NSData *pdfData = [render printToPDF ];
178
-
179
- [pdfData writeToFile: self .PDFpath atomically: YES ];
178
+
179
+ if (self.PDFpath ) {
180
+ [pdfData writeToFile: self .PDFpath atomically: YES ];
181
+ }
180
182
181
183
[self terminateWebTask ];
182
184
183
185
if (self.delegate && [self .delegate respondsToSelector: @selector (HTMLtoPDFDidSucceed: )])
184
186
[self .delegate HTMLtoPDFDidSucceed: self ];
185
-
187
+
188
+ if (self.delegate && [self .delegate respondsToSelector: @selector (HTMLtoPDFDidSucceed:withData: )])
189
+ [self .delegate HTMLtoPDFDidSucceed: self withData: pdfData];
190
+
186
191
if (self.successBlock ) {
187
192
self.successBlock (self);
188
193
}
You can’t perform that action at this time.
0 commit comments