I have developed a pdf viewer with all your suggestions and code snippets. Thanks :) Now i want to make it a pdf editor. I want to create an app for iphone/ipad similar to PDFKit(which is only for desktop). I want the user to be able to add annotations and highlight text sections.
How do I go about with this? So far, I have parsed the pdf content (my previous post is pdf parsing problem). Is there any open source pdf editor which adds annotation to existing pdf???
Also, can this be done using Objective-C or is there any other language code (C or javascript) which does this?
NSURL *newUrl = [NSURL fileURLWithPath:"path to pdf"];
CGPDFDocumentRef templateDocument = CGPDFDocumentCreateWithURL(newUrl);
CFRelease(url);
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
CGPDFPageRef page = CGPDFDocumentGetPage(templateDocument, 1);
CGContextDrawPDFPage(pdfContext, page);
const char *text = "second line!";
CGContextShowTextAtPoint (pdfContext, 10, 30, text, strlen(text));
CGContextEndPage (pdfContext);
CGContextRelease (pdfContext);
pdfcontext
is the same object I created while creating a new pdf. My pdf has a line like "hello world". I'm trying to add one more line.
I am getting the following error:
GContextShowTextAtPoint: invalid context 0x0