4

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

Felixyz
  • 19,053
  • 14
  • 65
  • 60
TechBee
  • 1,897
  • 4
  • 22
  • 46
  • 1
    possible duplicate of [Newbie wants to create a PDF reader for ipod touch - what's the best approach?](http://stackoverflow.com/questions/93297/newbie-wants-to-create-a-pdf-reader-for-ipod-touch-whats-the-best-approach) – Brad Larson Jul 16 '10 at 14:46

4 Answers4

7

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

davbryn
  • 7,156
  • 2
  • 24
  • 47
3

There is another simple way to read a PDF in iPhone/iPad:

  1. Take one UIwebView (name:pdfView).

  2. Give Iboutlet connection to it & Delegate it to FilesOwner

  3. In Viewdidload/VIewWillApper/VIewDidApper

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

Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
Archana Chaurasia
  • 1,396
  • 3
  • 19
  • 35
1

Use fastpdfkit: https://github.com/mobfarm/FastPdfKit

meersmans
  • 463
  • 5
  • 14
0

Firstly, save a built in pdf file in document Directory of iPhone Simulator (say it demo.pdf). then use following code in ViewController.m file at ViewDidLoad method and dont forget to add UIWebViewDelegate in 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]];
     }
Himanshu Mahajan
  • 4,779
  • 2
  • 36
  • 29