How to read pdf on ipad / iphone?

What is the way to read PDF content on an iPad or iPhone?

+4
source share
4 answers

You can use Quartz to parse a PDF document and extract metadata. PDF parsing

+7
source

There is another easy way to read a PDF file on iPhone / iPad:

  • Take one UIwebView (name: pdfView).

  • Give it a connection to YouTube and transfer it to FilesOwner

  • In Viewdidload / VIewWillApper / VIewDidApper

    [self.pdfView loadRequest:[NSURLRequest requestWithURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"ObjC" ofType:@"pdf"]]]]; 
  • ObjC.pdf should be in the resource folder

+3
source
+1
source

First, save the embedded pdf file in the Directory iPhone Simulator document (say demo.pdf). then use the following code in the ViewController.m file in the ViewDidLoad method and remember to add the UIWebViewDelegate to the ViewController.h file.

  -(void) viewDidLoad { [super viewDidLoad]; UIWebView theWebView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)]; theWebView.delegate=self; theWebView.scalesPageToFit=YES; [self.view addSubview:theWebView]; NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDir=[paths objectAtIndex:0]; NSString *fileName=[documentDir stringByAppendingPathComponent:@"demo.pdf"]; NSURL *url=[NSURL fileURLWithPath:fileName]; [theWebView loadRequest:[NSURLRequest requestWithURL:url]]; } 
0
source

Source: https://habr.com/ru/post/1315921/


All Articles