Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials

Reply
 
LinkBack Thread Tools Display Modes
Old 03-17-2010, 10:21 AM   #51 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 3
Default

This is exactly what I am looking for. Can I have the app e-mailed to me so I can play with it. I am so new that I don't understand a lot of what is stated above. If I had the app I think I could add my PDF and get it working. I hope.

jengel@mcg.edu

Thanks
John
onempty is offline   Reply With Quote
Old 05-13-2010, 06:40 AM   #52 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 4
Default Pdf project

Quote:
Originally Posted by danielb21 View Post
Hey everyone,

I've been extremely busy and haven't been able to reply till just now. I'm creating a simple project for this right now and will send to all that have PM'ed me.

Thanks!
Dan
Read your code with interest. I'm new to iPhone development so could you please send a copy of the project to me at steve.callahan@btinternet.com

Many Thanks
stevecallahan is offline   Reply With Quote
Old 05-18-2010, 07:25 AM   #53 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 1
Default

Thank you very much for your work.

And to all who keep asking for the code, just read the message list and download it from GitHub.
jcristo2 is offline   Reply With Quote
Old 05-19-2010, 12:45 AM   #54 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 1
Smile Thank you very much.

Hi this is exactly what I've been looking for.
Can you send me the source to goodjack@live.com?

Thank you very much!!!!
GoodJack is offline   Reply With Quote
Old 05-19-2010, 01:34 AM   #55 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 5
Default

Quote:
Originally Posted by danielb21 View Post
I have received several requests asking how to view a PDF after creating it natively in the iPhone. Below is a guide to doing just that. It uses the method I am currently using - a UIWebView. This provides you scrolling, zooming and navigating multiple pages without having to write any extra code. So, on to the code!
  1. In your project navigate to or create the directory you want to have the PDF Viewer.
  2. Create a new UIView subclass named 'PDFViewController'.
  3. Also create a new view in your resources directory named 'PDFView'.

This is what your PDFViewController.h should look like:

Code:
@interface PDFViewController : UIViewController  {
	UIWebView	*webView;
	NSURL	*pdfUrl;
}

@property (nonatomic, retain) IBOutlet UIWebView	*webView;
@property (nonatomic, retain) NSURL			*pdfUrl;

@end
Here we have created UIWebView object named webView, (which has an outlet to Interface Builder) and an NSURL object named pdfUrl.

This is what your PDFViewController.m should look like:

Code:
#import "PDFViewController.h"

@implementation PDFViewController

@synthesize webView, pdfUrl;

#pragma mark -
#pragma mark UIViewController methods

// View Did Load method -- Load the PDF
- (void)viewDidLoad {
	[super viewDidLoad];
	// Tells the webView to load pdfUrl
	[webView loadRequest:[NSURLRequest requestWithURL:pdfUrl]];
}
// Dealloc method -- webView, pdfURL
- (void)dealloc {
        [webView release];
        [pdfUrl release];
        [super dealloc];
}

@end
We synthesize our properties, release them in our deallocate method, and in our ViewDidLoad method, tell the webView to load pdfUrl.

Next open PDFView in Interface Builder.
  1. Make File's Owner Class Identity 'PDFViewController'.
  2. Add a Web View on top of the View.
  3. Hook up the view outlet on File's Owner to the View, and the webView outlet on File's Owner to the WebView.
  4. Hook up the delegate outlet on Web View to File's Owner.
  5. Save the file and quit Interface Builder.

Now the only other thing we need to do is Create an instance of PDFViewController, set the pdfUrl property and push the view. I am assuming here that you have some basic knowledge and am not going to get too detailed as to where you put the code that follows. Make sure that in the controller you place this code you have imported 'PDFViewController.h', otherwise it won't work.

Code:
// Create an instance of PDFViewController
PDFViewController *controller = [[PDFViewController alloc] initWithNibName:@"PDFView" bundle:nil];
// Get the path to our documents directory
NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// This should be our documents directory
NSString *saveDirectory = [documentPath objectAtIndex:0];
// Our PDF is named 'Example.pdf'
NSString *saveFileName = @"Example.pdf";
// Create the full path using our saveDirectory and saveFileName
NSString *finalPath = [saveDirectory stringByAppendingPathComponent:saveFileName];
// Set the pdfUrl to our finalPath
controller.pdfUrl = [NSURL fileURLWithPath:finalPath];
// Push 'controller'
[self.navigationController pushViewController:controller animated:YES];
// Release 'controller'
[controller release];
So, above we created an instance of PDFViewController, created a string that contains the path to our documents directory and a file named 'Example.pdf' in that directory. We set that string to pdfUrl for our controller, and pushed our controller.

That about does it, viewing PDFs on the phone couldn't be much easier than that! Please let me know if you have any questions or if something presented in this tutorial doesn't click.

Thanks!
Thanks for ur code. It works fine.Can u help me how to create a table in a pdf file & also add data to it?
Thanking you.
Niki is offline   Reply With Quote
Old 05-22-2010, 05:57 PM   #56 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 7
Default

Can someone please explain where this part of the code is supposed to go?

Code:
// Create an instance of PDFViewController
PDFViewController *controller = [[PDFViewController alloc] initWithNibName:@"PDFView" bundle:nil];
// Get the path to our documents directory
NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDire ctory, NSUserDomainMask, YES);
// This should be our documents directory
NSString *saveDirectory = [documentPath objectAtIndex:0];
// Our PDF is named 'Example.pdf'
NSString *saveFileName = @"Example.pdf";
// Create the full path using our saveDirectory and saveFileName
NSString *finalPath = [saveDirectory stringByAppendingPathComponent:saveFileName];
// Set the pdfUrl to our finalPath
controller.pdfUrl = [NSURL fileURLWithPath:finalPath];
// Push 'controller'
[self.navigationController pushViewController:controller animated:YES];
// Release 'controller'
[controller release];
aakburns is offline   Reply With Quote
Old 05-25-2010, 07:53 AM   #57 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 1
Default

hey get the ipod touch software 3.1.2 and download it.
then go to itunes and press option restore and click the software then go to blackra1n and press mac logo it will download and press make it rain. then your done. FOR MAC ONLY
__________________
Force Factor
Ever Brite Smile
francpender is offline   Reply With Quote
Old 06-18-2010, 11:47 AM   #58 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 1
Default Nice Work!

Congratularions for your fantastic work. I'm new on iphone development and due to this can't put the to work. Please, could you send the sample project to my email: cfbfs@hotmail.com
Thanks a lot.
cflavio is offline   Reply With Quote
Old 06-21-2010, 03:33 AM   #59 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 27
Default

hey may i have the sample code too?

stuck at the last part duno where should i be putting it.

Please send it to win11_6@hotmail.com

Thanks alot.
Zala is offline   Reply With Quote
Old 06-28-2010, 01:32 PM   #60 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 1
Default I need the Code, too

Hi,
could you please send me the sample code?
my e-mail: tterrafan@googlemail.com
Tterrafan is offline   Reply With Quote
Old 06-29-2010, 02:37 AM   #61 (permalink)
iphone developer
 
sivaram's Avatar
 
Join Date: Jun 2010
Location: Chennai
Age: 24
Posts: 32
Send a message via Skype™ to sivaram
Thumbs up plz send me the sample project....

Quote:
Originally Posted by DGoulian View Post
danielb21 - This is a great article - exactly what I have been looking for. Unfortunately, I can't get the code to work after several attempts. Can you post the project for download or email it to me at dgiii@cox.net. Thanks!

i have read your pdf article. Its really interesting .. plz send me the sample project...
c.j.sivaram@gmail.com
sivaram is offline   Reply With Quote
Old 07-07-2010, 12:23 AM   #62 (permalink)
Registered Member
 
bladeolson's Avatar
 
Join Date: Aug 2008
Posts: 31
Send a message via AIM to bladeolson
Default can you change the background color around a PDF?

I can't seem to find a way to change the background grey color around the PDF. Changeing in interface builder does nothing.

Also, anybody know how to remove the Page count indicator?

Blade
bladeolson is offline   Reply With Quote
Old 07-07-2010, 10:00 PM   #63 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 1
Default Hi please

Can you send me the code?
inlo@nate.com
inlo Kim is offline   Reply With Quote
Old 07-16-2010, 05:13 AM   #64 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 8
Default

I'd love to get the sample too.

jmoral88@gmail.com

Thank you in advance!
Boggard is offline   Reply With Quote
Old 07-18-2010, 05:33 AM   #65 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 3
Default

Thank you ! Very good and simple tutorial !
But i've a question: if you are reading a single page document, i see that the uiwebview has as default a big bounce in each side of the screen. So the question is: how can i remove this ?
ferroch85 is offline   Reply With Quote
Old 07-21-2010, 12:27 AM   #66 (permalink)
DSA
Registered Member
 
Join Date: Aug 2009
Posts: 26
Default

Great tutorial

Last edited by DSA; 10-18-2010 at 12:40 PM.
DSA is offline   Reply With Quote
Old 08-04-2010, 01:31 AM   #67 (permalink)
Registered Member
 
praveen_jm's Avatar
 
Join Date: Aug 2010
Posts: 2
Default How to edit PDF

Hi did u figure out how to edit a PDF document in iphone
praveen_jm is offline   Reply With Quote
Old 08-13-2010, 09:58 AM   #68 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 1
Default

hi,

Can I've the option to search the pdf content.
codesen is offline   Reply With Quote
Old 08-13-2010, 04:45 PM   #69 (permalink)
Registered Member
 
Raptusis's Avatar
 
Join Date: Aug 2010
Posts: 2
Default

Thanks for the useful code.
Raptusis is offline   Reply With Quote
Old 08-16-2010, 12:49 AM   #70 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 1
Default

Hi All! This is exactly what I've been looking for in two days.

Would you mind send me the source code to thomas.wh.lau@gmail.com?

Thank you for your help.
iThomas is offline   Reply With Quote
Old 08-18-2010, 05:51 PM   #71 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Vleuten, Utrecht, The Netherlands
Posts: 1
Default

Wow! Thanks for the code and tutorial this great example of how great community support can be! Works like a charm.

There is a bit of a declaration mixup though. Change pdfURL to pdfUrl to make it integrate with the code from the first example

For people who want to know where to place the resource code; replace the viewDidLoad in your [yourname]viewController.m file with this:

PHP Code:
 - (void)viewDidLoad {
    [
super viewDidLoad];

    
pdfUrl = [NSURL fileURLWithPath:[[NSBundle mainBundlepathForResource:@"[yourpdffilenamehere" ofType:@"pdf"]];
    [
webView loadRequest:[NSURLRequest requestWithURL:pdfUrl]];

As said, I changed pdfURL to pdfUrl in the example code supplied to integrate it with the tutorial by danielb21

Last edited by starbucky; 08-18-2010 at 05:54 PM.
starbucky is offline   Reply With Quote
Old 09-20-2010, 11:07 AM   #72 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 1
Smile thank & more request

Quote:
Originally Posted by danielb21 View Post
Hey everyone,

I've posted the project on github now because I can't keep up with all of the requests.

You can find it here:
danberry's PDF-Viewer at master - GitHub

Thanks!
Dan
Hi Dan,
Great, well described and very useful tutorial , helped me.
I am very new in iPhone app dev, and looking a tutorial to design pdf like creating table (report), currently using html table.

thanks a ton,
techsmith is offline   Reply With Quote
Old 09-21-2010, 07:46 PM   #73 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 1
Thumbs up Hola Daniel

Hi Daniel!!!

Can you send me your code of PDF Viewer for check my errors code,
Thanks.

my email is enlaceti@gmail.com

Good day!!


Quote:
Originally Posted by danielb21 View Post
Hey everyone,

I've been extremely busy and haven't been able to reply till just now. I'm creating a simple project for this right now and will send to all that have PM'ed me.

Thanks!
Dan
GerBO is offline   Reply With Quote
Old 09-22-2010, 10:30 PM   #74 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
Default

Hi Daniel,

Thanks a million.


Last edited by dexertmoon; 09-22-2010 at 11:55 PM.
dexertmoon is offline   Reply With Quote
Old 10-18-2010, 12:28 PM   #75 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 2
Default

Hi Dan!

Thanks for this tutorial, would it be alright to send me your sample code to play with?

thanks in advance

Pol

(polturtle@yahoo.com)
polites is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 243
19 members and 224 guests
ADY, Alsahir, beleg_1998, Dani77, diyora, fredidf, iDifferent, iph_s, JamesCahall, JasonR, mer10, Monstertaco, prchn4christ, Robiwan, Rudy, smithdale87, Speed, spiderguy84, timle8n1
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:15 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0