0
votes

I'm looking to allow users to edit text that I am inserting in a rectangle. It appears that right-click > edit text works, but it's a pretty clunky solution. I've looked through the properties of text, paragraph, canvas and rectangle but I'm not seeing anything that fits this. I've also looked into adding text-boxes to the rectangle but that's not exactly what I'm looking for.

The goal would be to let the user click on the text below and edit in-rectangle. enter image description here

The code for the last bit:

Text conclusionTitle = new Text("CONCLUSION:\n").SetFontSize(7).SetFontColor(ColorConstants.RED).SetBold();
            Text conclusionMessage = new Text("[Insert response here]").SetFontSize(6).SetFontColor(ColorConstants.RED);
            Paragraph conclusionParagraph = new Paragraph().Add(conclusionTitle).Add(conclusionMessage);
1
You should consider using form fields. - mkl
Mhhh... not really what I'm going for in this instance. Can you even put form fields within a rectangle/canvas? - S.Wangler
Form fields visualizations are annotations. Thus, they are not in a page canvas but kind of hover above. What you put into a page canvas is static, not editable in a normal pdf viewer. Form fields are for content a user can edit. - mkl
@mkl So you can overlay a form field on a canvas/rectangle? - S.Wangler
You set position and size of a form field, and then it's over whatever is drawn in the page content canvas there. - mkl

1 Answers

0
votes

If you want to allow the user to edit the text of a PDF you have a few options. You can either create a FreeTextAnnotation or you can create a form field that allows user-input. (i.e. CreateText or CreateMultiLineText).