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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

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

Reply
 
LinkBack Thread Tools Display Modes
Old 01-20-2011, 10:48 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
RUser is on a distinguished road
Default Writing HTML to PDF file

Hi iDevs,

I am trying to draw PDF from WORD(i.e .doc/.docx)file. For doing so, first i am loading the WORD file in UIWebView and then firing the following java script code in webViewDidFinishLoad to get contents of WORD file in HTML format.

- (void)webViewDidFinishLoad: (UIWebView *)webView
{
NSString *wordDoctext = [webView stringByEvaluatingJavaScriptFromString:@"document. body.innerHTML"];
}


Now i want to write this HTML on PDF file in such a way that contents will look exactly like it appear in WORD file.
RUser is offline   Reply With Quote
Old 01-21-2011, 03:45 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

iphone - Get a PDF/PNG as output from a UIWebView or UIView - Stack Overflow

however to create pdf programmatically, you can start here
Generate PDF on iPhone


Drawing With Quartz2d
__________________
dany_dev is offline   Reply With Quote
Old 01-26-2011, 11:20 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 14
RUser is on a distinguished road
Default PoDoFo Library in iPhone app

Hi Guys,

Have any one of you implemented PoDoFo library in iPhone App? Actually I want to convert HTML to PDF file. So that PDF & HTML both will display the contents in same design format. If you have any other alternative to do so then kindly help me.

Thanks in advance.

Last edited by RUser; 01-26-2011 at 11:28 PM.
RUser is offline   Reply With Quote
Old 02-02-2012, 02:56 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 1
seval is on a distinguished road
Default

The most reliable solution I found is to create a service on a server and call that service from app. For the server side converter you can use something like hiqpdf html to pdf solution but there are plenty of choices for this approach if it is acceptable for your project of course
seval is offline   Reply With Quote
Old 03-20-2012, 04:20 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 1
ocrickard is on a distinguished road
Default HTML to PDF

I know I'm a little late to the party here, but thought that if anyone else needs help with this, I would provide some insight. I've created a little example of how to use DTCoreText to take a HTML file in NSString UTF8 format, and render it into a paged PDF context. The example only renders text with basic CSS formatting at the moment. The nice thing is that this renders real PDF raw text in the document, not rasterized images as you get with the UIWebView alternative. The code saves the PDF file in the app's documents folder under a unique ID string, and hands back the path to this file from the class methods.

You can get the full source of my sample app here: https://github.com/ocrickard/OCPDFGen

This little library took me about an hour to slap together originally for an app I made last year. Most of the apps I do are for engineering enterprise applications where connection to a server is almost never available (think tunneling, oil exploration, etc.). If your app can depend on a data connection, and your files aren't so large that your users aren't waiting too long, then obviously the server-route is optimal because it can handle more complex HTML elements.

EDIT: Forgot to mention that it may be possible to implement more features of DTCoreText like simple image rendering, etc. My uses don't require it, so I haven't looked into it much, but I'm sure you could look at the DTCoreText CoreText frame-setter and formatting engine to quickly learn how to use their code...

Last edited by ocrickard; 03-20-2012 at 04:27 PM.
ocrickard is offline   Reply With Quote
Reply

Bookmarks

Tags
html, iphone, pdf, xcode

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 354
10 members and 344 guests
7twenty7, dre, iAppDeveloper, jeroenkeij, Mah6447, Morrisone, sacha1996, Sami Gh, stanny, toon4413
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

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