Please take a look at this demo: XML Worker.
In this demo, we use an online editor such as TinyMCE. This editor allows you to introduce styles, such as bold, italic,... and so on. The 'text' is sent to the server as simple XHTML. This simple XHTML is converted to PDF using XML Worker.
If you don't need styles, please take a look at the samples in the FAQ. Just enter some text in either one of the text fields and then click the button below the text. The code to do this, is really easy. See the code of the PdfServlet that runs on the server side.
Once you have the PDF with the text created by the end-user, you can merge the original file with the notes using PdfCopy
.
Of course: maybe you don't want to add the notes as extra pages, but as annotations. In that case, you need the PdfStamper
class and its addAnnotation()
method.
I could make the answer to this question much longer, but that's because your question is rather broad. Please be more specific, so that a more specific answer can be given.
Update: XML Worker has been replaced with pdfHTML in iText 7.