Home > Enterprise >  jsPDF how to create a multiline editable acrobat reader form field with dynamic height?
jsPDF how to create a multiline editable acrobat reader form field with dynamic height?

Time:01-28

I've got the editable part down and it seems to be multi line but as you type into the field the height of the field stays the same and the font just gets smaller. enter image description here

    doc.text(20, 220, "Notes:");
    var notesField = new TextField();
    notesField.multiline = true;
    notesField.maxFontSize = 12;
    notesField.height = 150;
    notesField.Rect = [280, 202, 160, 18];
    notesField.fontSize = 12;
    doc.addField(notesField);

CodePudding user response:

It's not possible. You can't have a field with a dynamic height as an AcroForm field. You'd need to create an XFA form, which jsPDF doesn't currently support.

CodePudding user response:

This works for creating a multiline box with a fixed height. I haven't figured out how to create one with a dynamic height yet.

 doc.text(20, 220, "Notes:");
 var notesField = new TextField();
 notesField.multiline = true;
 notesField.maxFontSize = 12;
 notesField.height = 150;
 notesField.Rect = [280, 202, 160, 148];
 notesField.fontSize = 12;
 doc.addField(notesField);
 doc.line(280, 200, 440, 200);```
  • Related