create pdf with a template pdf and add image, text, barcode, and complete field form , objective c, OS X - objective-c

I am a newbie at Objective-C. I'm working on a project for a OSX. I have a pdf template file with form fields, and I need to use it to generate a new pdf adding some images, text, barcode, and complete form fields.
I've been researching for working with PDFs, I'm trying to use Quartz 2D, CGPDFContext, and at this moment I managed to fill a new pdf with the page template, but I donĀ“t know how to do to write on the fields forms and add other images.
How can I draw at specific point, text or image? or exist any library to manage pdf? and for generate barcode128? Thank you so much!

Once you have a CGPDFContext you can draw whatever you want into it as you would with any other context. A simple solution is to create a CALayer (or a view and then access its layer) with the content you want and then to draw that layer into your PDF context.
Getting the editable text fields isn't so easy, this might help.
If you can do away with the PDF template and do the whole thing as a view that you render into a PDF context that would be easier, but the process is generally the same once you know where you need to draw your additional text / graphics.

Related

Creating a searchable PDF from one already existing PDF and text (with coordinates)

My Situation:
I have an existing PDF with only images
I have a preprocessed OCR with all text identified and their respective coordinates
An application running in C#
I can use other programming languages if needed
My Question:
-> Do you know a way to create a searchable PDF using those existing resources (Images and Text with their coordinates) <-
I'm doing a lot of research but most of the results I get only show how to create a searchable PDF using some library (iText, PDF Sharp, etc.) that uses their built-in OCR engine, that is not my case, I already have the text and coordinates.
Thank you for any help and thought you can provide me.

Creating a custom diploma from a designer template, filling in data

I need to be able to create PDFs with printable diplomas for sports events (10K runs etc).
A graphic designer creates a beautiful diploma with placeholder texts (name of participant, finish time) - and I need to get from that to a finished PDF (on the fly), which the participant can download.
What output should I get from the designer (file format, prepared in any special way)?
How do I take that file, fill in data and generate PDF?
How can this be accomplished using IText?
I have done a lot of generating PDFs from HTML and Word docs, but this is something new to me, so I am can't figure out where to start.
My best idea right now is to have the designer export as PDF without placeholder text, but with x/y coordinates and font on where to input name, time etc... But I would prefer to not have to store the x/y coordinates, font etc - and just be able to fill in a "template"...
There are several possibilites e.g:
Let your designer create a diploma PDF
Add form fields at the places you want to add name and event etc. This can be done by you or the designer or a PDF lib like openPdf / PdfBox / iText
Fill in the data using openPdf / PdfBox / iText and afterwards make the field readonly
You could even sign the PDF afterwards (and thus "protect" it from changes)
OR
2a) You could also add text to an existing PDF but this is a bit trickier since you need to know the coordinates and need to care about length issues etc.

Create template for PDF creation in Cocoa / Objective C

I am coding a Mac application. I want to give the user the opportunity to create a template for PDF creation. The PDF should be created from different NSTextFields where the users types in. So, the PDF creation should be dynamic. For example for an invoice. The format stays while the information on the PDF changes.
I use a NSTextView with a ruler which is always shown. Now I want to write for example <TextField1> in some point of the Sheet and where this TextField1 is, the input from TextField1 should be. I thought about getting the position of TextField1 and using it in the PDF creating process. But I am still not sure if its the right way. The PDF should always be for A4 format. Is it even possible to set the PDF View (on the screen) to an A4 view, so the user can see how the PDF will look in a printed version ?
The ruler is shown by using [textView setRulerVisible:YES];

UILabel with basic rich text support

My ipad application has a custom look. It uses text labels extensively for displaying partly colored/shadowed/bold texts. Larger pieces of text may contain numbered lists and embedded Images. There could be couple rich text regions on a single page.
I am not sure that UIWebView is the right tool for displaying strings like:
MyApp title
Hello rich text world
List item
List item
Writing my own text rendering engine looks more sufficient to me than using UIWebView.
Any ideas for lightweight rich text renderer ? c library or custom control ?
I would recommend using TTStyledLabel from the Three20 library. It provides the desired functionally and would save you the time of writing your own.

How do I embed a source PDF onto an existing page in a PDF?

I need to programmatically embed an existing PDF (a small graphic) onto a specfic page on an existing PDF. Using iTextSharp I've been able to add a new page containing this embedded PDF, but what need is to modify an existing page by adding this graphic. Is this possible using iTextSharp or any other PDF-generation libarary?
I tend to do this sort of thing using Context, which is a Tex-based layout tool that in integrated into the pdftex Tex/Metapost engine. There's a learning curve involved, and installing Context isn't entirely trivial, but it makes very general programmatic document processing involving PDFs easy once you get the hang of it.
For this problem, you'd define two overlays, with the first overlay being the main PDF that you set to a background, and then on the page you want to change, defining a foreground overlay with a \setlayer command, which contains a single \framed box, which superimposes the second PDF using a \externalfigure command.
The nice thing about Context for this kind of task is that it works with PDF as its internal representation all the way through, so there is no unexpected blow up in file size or deterioration in image quality, which you can get with other tools that convert between formats.