Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 927749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:54:06+00:00 2026-05-15T19:54:06+00:00

I am having difficulty with a UIWebView which shows http URLs correctly, but not

  • 0

I am having difficulty with a UIWebView which shows http URLs correctly, but not bundled .pdf files.

I have also read alternative solutions such as using QuartzCore framework, however this does not seem to support multiple pages in PDFs.

Here is the code that works (for google dot com)

- (void)viewDidLoad

{
 [super viewDidLoad];

 NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"file" ofType:@".pdf"];

 NSURL *pdfURL = [NSURL URLWithString:pdfPath];

 CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
 webFrame.origin.y += kTopMargin - 20.0; // leave from the URL input field and its label
 webFrame.size.height -= 00.0;
 self.webView = [[[UIWebView alloc] initWithFrame:webFrame] autorelease];
 self.webView.backgroundColor = [UIColor whiteColor];
 self.webView.scalesPageToFit = YES;
 self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
 self.webView.delegate = self;
 [self.view addSubview: self.webView];

 [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}

And for the PDF, I have replaced

[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];

with

[self.webView loadRequest:[NSURLRequest requestWithURL:pdfURL]];

My immediate thought was that the iPhone SDK does not support PDF viewing in its webview, however, tutorials like this one seem to show other users having success with this. So do you think I am just missing something in my code?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:54:07+00:00Added an answer on May 15, 2026 at 7:54 pm

    UIWebView does support pdf when using loadRequest as you are doing.

    pathForResource:@"file" ofType:@".pdf"
    

    Take the . out of .pdf

    Edit:

    [NSURL URLWithString:pdfPath];
    

    Use fileURLWithPath: instead.

    Check that pdfPath and pdfURL are what you expect them to be.

    NSLog( @"%@" , pdfURL );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some difficulty using a UIWebView to render PDF files on the
I have a multi-column layout in a UIWebview (webkit control) but I'm having problems
Having difficulty indexing an attachment type in elasticsearch via the Tire gem. Not able
I'm essentially having difficulty pass dynamic variables to a view. I have php functions
I am having difficulty with the following code which is inside a static method
Having difficulty making my javascript act the way I want. I have a button,
I'm having difficulty getting my textarea to expand vertically automatically. I have some code
I'm having difficulty with this problem. I have a table with this structure: OrderID
I am having difficulty deciding which is the best method for saving my app
i am having difficulty implementing phpass into my login procedure - not knowing how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.