How to add text on top of PDF Document?
I've loaded a PDF Document into a UIView Class, and displayed it on screen using CGDrawRect. So Now I can visually see the PDF: What I want to do is have the user click certain points of the file, which will bring up the key board, allowing the user to directly add text to the PDF, which will later need to be rendered - some direction or guide would be very helpful ?
There are two possible scenarios here:
Editing existing PDF text is very difficult, even with something like PSPDFKit. It is no accident that there are no PDF-based word processors.
Annotating PDF content is more straightforward:
Add any additional content as subviews to the UIView
that contains the PDF document. Additional content can be in the form of text, vectors or images - anything that can be added to a UIView
. At this point you do not need to worry whether the added content is "part of" the PDF.
When you want to render the added content to the PDF, simply render the container view (which contains both the original document and annotations) to a PDF Context using UIGraphicsBeginPDFContextToFile
and UIGraphicsBeginPDFPage
.
Check this question and answer for a simple example and a method for ensuring that the PDF is rendered as vectors, not as a bitmap: Rendering a UIView into a PDF as vectors on an iPad - Sometimes renders as bitmap, sometimes as vectors
链接地址: http://www.djcxy.com/p/65450.html上一篇: Itext将字体嵌入到PDF中
下一篇: 如何在PDF文档上添加文本?