Last active
December 12, 2015 02:28
-
-
Save bigtunacan/4698632 to your computer and use it in GitHub Desktop.
Create a PDF from a webpage on iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)generatePDFFromWebView | |
{ | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSString *pdfPath = [fileManager applicationSupportDirectory]; | |
pdfPath = [pdfPath stringByAppendingPathComponent:@"exportedData.pdf"]; | |
self.PDFCreator = [NDHTMLtoPDF createPDFWithURL:[NSURL URLWithString:@"www.cnn.com"] | |
pathForPDF:pdfPath | |
delegate:self | |
pageSize:kPaperSizeA4 | |
margins:UIEdgeInsetsMake(10, 5, 10, 5)]; | |
return pdfPath; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment