@@ -222,7 +222,20 @@ public static PdfTextFormField createText(PdfDocument doc) {
222
222
public static PdfTextFormField createText (PdfDocument doc , Rectangle rect ) {
223
223
PdfWidgetAnnotation annot = new PdfWidgetAnnotation (rect );
224
224
return new PdfTextFormField (annot , doc );
225
+ }
225
226
227
+ /**
228
+ * Creates a named {@link PdfTextFormField text form field} with an initial
229
+ * value, and the form's default font specified in
230
+ * {@link com.itextpdf.forms.PdfAcroForm#getDefaultResources}.
231
+ *
232
+ * @param doc the {@link PdfDocument} to create the text field in
233
+ * @param rect the location on the page for the text field
234
+ * @param name the name of the form field
235
+ * @return a new {@link PdfTextFormField}
236
+ */
237
+ public static PdfTextFormField createText (PdfDocument doc , Rectangle rect , String name ) {
238
+ return createText (doc , rect , name , "" );
226
239
}
227
240
228
241
/**
@@ -1910,7 +1923,7 @@ protected PdfFormXObject drawMultiLineTextAppearance(Rectangle rect, PdfFont fon
1910
1923
clip ().
1911
1924
newPath ();
1912
1925
1913
- Canvas modelCanvas = new Canvas (canvas , getDocument (), new Rectangle (3 , 0 , width - 6 , height - 2 ));
1926
+ Canvas modelCanvas = new Canvas (canvas , getDocument (), new Rectangle (3 , 0 , Math . max ( 0 , width - 6 ), Math . max ( 0 , height - 2 ) ));
1914
1927
Paragraph paragraph = new Paragraph (value ).setFont (font ).setFontSize (fontSize ).setMargins (0 , 0 , 0 , 0 ).setMultipliedLeading (1 );
1915
1928
setParagraphProperties (paragraph , value );
1916
1929
if (value != null && value .length () > 0 ) {
0 commit comments