Skip to content

Commit 3158004

Browse files
committed
Port new acroforms samples. Minor additions
1 parent daf7778 commit 3158004

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

forms/src/main/java/com/itextpdf/forms/fields/PdfFormField.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package com.itextpdf.forms.fields;
22

3-
import com.itextpdf.core.PdfException;
43
import com.itextpdf.basics.codec.Base64;
54
import com.itextpdf.basics.font.FontConstants;
65
import com.itextpdf.basics.font.PdfEncodings;
7-
import com.itextpdf.core.geom.Rectangle;
86
import com.itextpdf.basics.image.Image;
97
import com.itextpdf.basics.image.ImageFactory;
108
import com.itextpdf.basics.source.PdfTokenizer;
119
import com.itextpdf.basics.source.RandomAccessFileOrArray;
1210
import com.itextpdf.basics.source.RandomAccessSourceFactory;
11+
import com.itextpdf.core.PdfException;
1312
import com.itextpdf.core.color.Color;
1413
import com.itextpdf.core.color.DeviceCmyk;
1514
import com.itextpdf.core.color.DeviceGray;
1615
import com.itextpdf.core.color.DeviceRgb;
1716
import com.itextpdf.core.font.PdfFont;
1817
import com.itextpdf.core.font.PdfFontFactory;
18+
import com.itextpdf.core.geom.Rectangle;
1919
import com.itextpdf.core.pdf.PdfArray;
2020
import com.itextpdf.core.pdf.PdfDictionary;
2121
import com.itextpdf.core.pdf.PdfDocument;
@@ -229,9 +229,9 @@ public static PdfTextFormField createText(PdfDocument doc, Rectangle rect) {
229229
* value, and the form's default font specified in
230230
* {@link com.itextpdf.forms.PdfAcroForm#getDefaultResources}.
231231
*
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
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
235235
* @return a new {@link PdfTextFormField}
236236
*/
237237
public static PdfTextFormField createText(PdfDocument doc, Rectangle rect, String name) {
@@ -277,13 +277,13 @@ public static PdfTextFormField createText(PdfDocument doc, Rectangle rect, Strin
277277
* Creates a named {@link PdfTextFormField text form field} with an initial
278278
* value, with a specified font and font size.
279279
*
280-
* @param doc the {@link PdfDocument} to create the text field in
281-
* @param rect the location on the page for the text field
282-
* @param name the name of the form field
283-
* @param value the initial value
284-
* @param font a {@link PdfFont}
285-
* @param fontSize a positive integer
286-
* @param multiline true for multiline text field
280+
* @param doc the {@link PdfDocument} to create the text field in
281+
* @param rect the location on the page for the text field
282+
* @param name the name of the form field
283+
* @param value the initial value
284+
* @param font a {@link PdfFont}
285+
* @param fontSize a positive integer
286+
* @param multiline true for multiline text field
287287
* @return a new {@link PdfTextFormField}
288288
*/
289289
public static PdfTextFormField createText(PdfDocument doc, Rectangle rect, String name, String value, PdfFont font, int fontSize, boolean multiline) {
@@ -1344,6 +1344,8 @@ public <T extends PdfFormField> T setAction(PdfAction action) {
13441344

13451345
/**
13461346
* Changes the type of graphical marker used to mark a checkbox as 'on'.
1347+
* Notice that in order to complete the change one should call
1348+
* {@link #regenerateField() regenerateField} method
13471349
*
13481350
* @param checkType the new checkbox marker
13491351
*/
@@ -2162,7 +2164,7 @@ protected void drawCheckBox(PdfCanvas canvas, float width, float height, int fon
21622164
beginText().
21632165
setFontAndSize(ufont, fontSize).
21642166
resetFillColorRgb().
2165-
setTextMatrix((width - ufont.getWidth(text, fontSize)) / 2, (height - ufont.getAscent(text, fontSize) ) / 2).
2167+
setTextMatrix((width - ufont.getWidth(text, fontSize)) / 2, (height - ufont.getAscent(text, fontSize)) / 2).
21662168
showText(text).
21672169
endText();
21682170
}

0 commit comments

Comments
 (0)