Modify / edit PDF file
I want to edit the shown pdf.
I am currently creating one custom PDF page
CGPDFDocumentRef and CGPDFPageRef.
Now I will just add a transparent image to the entire current page . After the image has been added, I want to write it back to the same file .
But PDF can be multi paged .
My actual approach for this would be to show the PDF as normal CGPDFPageRef and display it.
I would use UIGraphicsBeginPDFContextToData to add this custom image.
Now I need to know how to get PDF data from unmodified pdf and insert it into UIGraphicsBeginPDFContextToData.
Then I would add this image to the context and write it to a file.
Am I still right, or should I do it another way.
Here is my current example code:
//find a solution to inject the current shown page / current pdf document as pdfData
UIGraphicsBeginPDFContextToData(pdfData, a4Page, nil);
CGContextRef context = UIGraphicsGetCurrentContext();
UIGraphicsBeginPDFPage();
UIGraphicsEndPDFContext();
[pdfData writeToFile:newFilePath atomically:YES];
[fileMetaData release];
source to share
No one has answered this question yet
Check out similar questions: