在ipad应用程序中的pdf下载链接无法正常工作

问题描述 投票:0回答:1

我有一个独立的离线html应用程序,不适合在服务器上部署。我已将该html应用程序转换为ipad应用程序。

该应用程序具有本地pdf和excel文件的链接。我提供了在应用程序中下载这些文件的链接。它在浏览器中工作正常。

但是在ipad中,下载pdf报告和Excel工作表报告的链接不起作用(即使我点击了pdf没有显示的链接。它的行为就像一个死链接!)

任何建议都非常感谢!

ipad pdf
1个回答
2
投票

要下载pdf,请尝试以下操作:

1)创建一个按钮来调用printTapped()方法(这里UIBarButtonItem对此有好处)

printTapped()

- (void)printTapped 
{  


    NSData *pdfdata = [[NSData alloc] initWithContentsOfURL:@"try your url from where you want to download the pdf"];

    //Store the Data locally as PDF File

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
    NSString *docsDirectory = [paths objectAtIndex:0];

    NSString *filePath = [docsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.pdf",app.stritreejob]];

      //=======//
}
© www.soinside.com 2019 - 2024. All rights reserved.