Converting data to PDF on iPad/iPhone - iphone

Let us say I have an application that has a bunch of text and image data. It there a way to then convert the strings and images within my application into PDF format which I could then email?
What would be the best approach to this?

With such a general question, it's hard to answer with anything that isn't more or less a repetition of what Apple's docs say: Generating PDF Content

Apple's support docs are pretty good on this. The gist of it is you want to create a pdf graphics context CGPDFContext and then draw to it. The wierdest thing is that you have to flip the y axis on your drawings to PDF because iOS and Core Graphics use different origins for the axis. All this is explained in the apple docs though. If you have any specific questions, I'm new to developing and stack overflow, but I'd be happy to help you out.
If you want to see how my app writes PDF, check out Photo Logger in the app store.

Related

iOS Fill use app data (strings, ints, images, etc) to fill out a pdf form and email it

So I've got this idea for a project and am looking for some solutions on how to complete it. Right now I have an iphone app set up to take in a bunch of user information and an image of a signature they draw. I have a pdf waiver that needs to be populated with this data and the signature. Is there any way to overlay this data on the form? Is there a way to create an html document with the form as the background and then the data laid over the top with css?
If this is possible, then what's the best way to get that new pdf or html page to a website/folder/email.
Would appreciate any help with that. Thanks!
For reference and theoretical explanations.. you can check Apple page https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html
Some nice tutorials:
http://www.raywenderlich.com/6581/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-1
http://www.ioslearner.com/convert-html-uiwebview-pdf-iphone-ipad/
http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/

interactive pdf on the iOS

I have been looking for a way to present an interactive pdf file (created by in-design) on
the iPhone. I read a bunch of questions here but none says how to do it. The pdf file contain the text and in the middle it contains a 3d module, but when I present it on the iPhone it shows only the text and an empty white box where the module should appear.
Is it even possible to do it?
I'll be glad for any assistant on this subject or even where to look.
Thanks in advance,
Shahar.
Apple's PDF parser does not support 3D stuff. You're better of implementing the 3D part yourself and just adding that as a UIView on top of the PDF. There are several PDF frameworks that help with that (see https://stackoverflow.com/questions/3801358/pdf-parsing-library-for-ios)
Another alternative might be licensing Adobe's iOS rendering engine. But I doubt that they already added 3D support (or that they will be). Also, from what my sources tell me, pricing is rather high and apparently the framework not very developer friendly. (But I haven't used it myself)

How can I edit PDF files in an iOS application?

In my iPhone / iPad application, I show a person's medical reports in the form of a PDF. I have saved the reports in the documents directory and am reading them from there.
I want the user to be able to add or edit comments on these PDFs, as well as be able to highlight certain sections in the PDF. After editing, the application should be able to save the PDF back into the documents directory.
Is this possible within an iOS application? If so, how? Is this a task for Core Graphics?
Editing PDF directly on iPad/iPhone is a rather big job because the standard API only supports showing it (and only a bit more.) If you want to do anything more, you need to invest a huge amount of time to implement generic pdf handling code.
There is an open-source library handling these, e.g. this one. I don't know if it fits your needs, though.
A better idea, in my opinion, is to create a native UI showing the data contained in the PDF file using the standard Cocoa-Touch UIKit and create the PDF once the user is done with it so that the user can export it back. That way, you don't have to write a complicated PDF handling code.
In any case, it's not a good idea to show generic PDF on iPhone, because the screen size is so small (iPad is a different question, especially if you expect the user to be familiar with the particular format of your pdf.). A dedicated UI would be much better.

What is the most elegant way to view a multipage PDF in iOS application?

I am stuck in a predicament whereby I hope someone can help me.
I am consuming a web service that returns a multi page PDF document as a Base64 payload. I want to be able to view the PDF on a page by page basis. For example I get the following string back in a long Base 64 encoded form within image tags :
<image>JVBERi0xLjMNCiXi48/TDQoxIDAgb2JqDQo8PA0KL01vZER........</image>
I am not wanting to use a UIWebView to view the fax but a simple very basic PDF viewer with pagination. I know there are some libraries like Fast PDF Kit but that would not work because they show the logo and the license is a little pricey.
I am a PDF newbie so if someone can show by a small example I would truly appreciate that.
I'm not sure why you don't want to use UIWebView since it probably does everything you need. PDF parsing guide from Apple will show you how to implement this by hand:
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html

Drawing a PDF full of formatted text with images on the iPhone

Is it possible to create a page with formatted text that is stored in core data. The text would need to be displayed with paragraphs and a few images. I have already written the code to create a PDF with one line of text, but I am unsure of the pattern needed to layout the PDF in a nice document way. One of reasons is I had to write the code in C. The data that will be in the document is of course In core data. And I do not know what the best practice is for what I am trying to do.
Unless you have a particular need for PDF, the best practice is to use HTML and UIWebView. WebView is the primary formatted-text displayer for iPhone. iPhoneOS 3.2 added CoreText, which is another option if you have serious layout needs, but it generally isn't needed for simple formatted text and data.
The Text and Web Programming Guide includes a good discussion of your formatting and layout options. Generally UIWebView is still your best bet.
I am quite sure NSData (your c bytes) could be stored in NSManagedObject.
Even if not. Why don't store only metadata in CoreData? Is much more simpler for example: info needed to render the page wanted, etc.
I am not sure archiving the hole PDF in CoreData is a good approach.