File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 2424import java .io .OutputStream ;
2525import java .util .ArrayList ;
2626import java .util .List ;
27+ import java .util .regex .Pattern ;
2728import org .apache .logging .log4j .Logger ;
2829import org .apache .logging .log4j .LogManager ;
2930import org .apache .fontbox .util .BoundingBox ;
@@ -68,6 +69,8 @@ class AppearanceGeneratorHelper
6869
6970 private static final Operator BMC = Operator .getOperator ("BMC" );
7071 private static final Operator EMC = Operator .getOperator ("EMC" );
72+
73+ private static final Pattern PATTERN = Pattern .compile ("\\ u000D\\ u000A|[\\ u000A\\ u000B\\ u000C\\ u000D\\ u0085\\ u2028\\ u2029]" );
7174
7275 private final PDVariableText field ;
7376
@@ -196,7 +199,7 @@ public void setAppearanceValue(String apValue) throws IOException
196199 // see PDFBOX-3911
197200 if (field instanceof PDTextField && !((PDTextField ) field ).isMultiline ())
198201 {
199- value = value .replaceAll (" \\ u000D \\ u000A|[ \\ u000A \\ u000B \\ u000C \\ u000D \\ u0085 \\ u2028 \\ u2029]" , " " );
202+ value = PATTERN . matcher ( value ) .replaceAll (" " );
200203 }
201204
202205 for (PDAnnotationWidget widget : field .getWidgets ())
You can’t perform that action at this time.
0 commit comments