How to display pdf on iOS

后端 未结 12 1109
半阙折子戏
半阙折子戏 2020-12-12 18:30

I want to know if there is any way for a offline build for xcode iOS such that we can display pdf file from local file.

The method I\'m using now is vi

12条回答
  •  既然无缘
    2020-12-12 18:59

    It's late but there is some limitation with UIWebview on loading pdf files, It won't load editable pdf properly. so load any type of pdf files use following code

    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"pdfFileName" ofType:@"pdf"]];
    PDFView *view = [[PDFView alloc] initWithFrame:self.view.frame];
    view.document = [[PDFDocument alloc] initWithURL:url];
    [self.view addSubview:view];
    

提交回复
热议问题