从web服务到iPhone的pdf
如何从服务器下载文件 有没有办法将pdf文件从web服务发送到iPhone从web服务到iPhone的pdf,iphone,Iphone,如何从服务器下载文件 有没有办法将pdf文件从web服务发送到iPhone 是否需要将pdf转换为其他格式,然后发送并重新转换?您可以使用以下代码轻松下载pdf文件 NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:downloadUrl]]; //Store the Data locally as PDF File NSString *resourceDocPath = [[NS
是否需要将pdf转换为其他格式,然后发送并重新转换?您可以使用以下代码轻松下载pdf文件
NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:downloadUrl]];
//Store the Data locally as PDF File
NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *pdf1;
pdf1 = [NSString stringWithFormat:@"%@.pdf",yourBookTitle];
NSString *filePath = [resourceDocPath stringByAppendingPathComponent:pdf1];
[pdfData writeToFile:filePath atomically:YES];
对于第二个问题,将您的pdf文件存储到服务器并获取Url,无需以任何格式转换