How can I output tables to a PDF file with the iPhone SDK? - iphone

I want to output a PDF using UIKit's PDF creation methods. I see plenty of information on the web about creating a graphic context in a PDF, but I want to create smart text tables whose cells the user can later copy and paste into other applications (Word, Excel, etc.). How do I do this?

Unfortunately, that's not trivial. I recommend you the libharu PDF library for iPhone as a good point to start from.

Related

asp.net web application to convert pdf to word

Is there any clear and proper process to convert a pdf file into a word file with all formatting and images in asp.net web application?
The best way to do that is by using the OCR. It will recognize the text and the images in the PDF file, and then you can save it on a DOC file. I know a third party toolkit named leadtools that should help you doing your requirements, since it support the ASP.NET environment. You can check their Online OCR Demo
Also, you can check their website for more information, or contact their support team.
PDF is a presentational format where all the content is placed by absolute positions. There are no paragraphs and other structured elements (unless it is a Tagged PDF). Technically, you can output every word character by character in any order, but visually it would look like a normal text. Thus, to make a proper conversion to word it is required to do content recognition or some kind of OCR (e.g. ABBYY FineReader)
There are some paid components on the market that allow to do text extraction and some do converting pages to images (obviously, this is not a desired approach for converting into word).

How to read pdf table content data?

I have a requirement to read a pdf file having tabular format data only like in excel file. I need to extract the cell value of given pdf file.
Is it be anyhow possible using itext API. If you have something to share then please share it or any other solutions?
The PDF format is just a canvas where text and graphics are placed without any structure information. As such there aren't any iText-objects in a PDF file. In each page there will probably be a number of Strings, but you can't reconstruct a phrase or a paragraph using these strings. There are probably a number of lines drawn, but you can't retrieve a Table-object based on these lines.
In short: parsing the content of a PDF-file is NOT POSSIBLE with iText.
You can try this! This lets you read PDF pages.
I recently ran into this problem. I wasn't able to make it work with itext.
An alternate solution I found was to open a PDF document in Adobe and export it to xml. At least with my PDF's it preserved the table information and then I was able to programmatically work with the XML to generate tabular files like excel etc.
The other issue I ran into was that Adobe only lets you export one file at a time and I had lots of files. Luckily Adobe also has a merge function. I ended up merging all the files together and then exporting them as one big XML file and working with that file to generate what I needed.

editing pdf contents in uiwebview iphone

hi im working on pdf manipulation.
my requirements are to edit the existing pdf document.
looks like there is no actual way to do it. i found out using javascript i can edit the html contents.
so now that my pdf is in uiwebview is there any way to convert pdf document to html content???
i have to do it programatically.
preferred language is objective c but its k if any suggestions in C/C++
thanks in advance
You will have to drop down to C if you want to do this. Basically you need to get hold of a CGPDFDocumentRef reference, and through that iterate each CGPDFPageRef. From the page you can get access to the CGPDFContentStreamRef.
From the content stream you can parse out the primitive data that is is PDF document. From there only a good understanding of the PDF document format can help you.
I would advice you to find a commercial tool, hire an experience contractor, or change your plan. What you have your sights on is allot of hard work.

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.

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.