1 | /* | |
2 | * $Id: PdfAcroForm.java 3912 2009-04-26 08:38:15Z blowagie $ | |
3 | * | |
4 | * Copyright 2002 Bruno Lowagie | |
5 | * | |
6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
7 | * (the "License"); you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
9 | * | |
10 | * Software distributed under the License is distributed on an "AS IS" basis, | |
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 | * for the specific language governing rights and limitations under the License. | |
13 | * | |
14 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
15 | * | |
16 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
17 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
18 | * All Rights Reserved. | |
19 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
20 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
21 | * | |
22 | * Contributor(s): all the names of the contributors are added in the source code | |
23 | * where applicable. | |
24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of the | |
26 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
27 | * provisions of LGPL are applicable instead of those above. If you wish to | |
28 | * allow use of your version of this file only under the terms of the LGPL | |
29 | * License and not to allow others to use your version of this file under | |
30 | * the MPL, indicate your decision by deleting the provisions above and | |
31 | * replace them with the notice and other provisions required by the LGPL. | |
32 | * If you do not delete the provisions above, a recipient may use your version | |
33 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
34 | * | |
35 | * This library is free software; you can redistribute it and/or modify it | |
36 | * under the terms of the MPL as stated above or under the terms of the GNU | |
37 | * Library General Public License as published by the Free Software Foundation; | |
38 | * either version 2 of the License, or any later version. | |
39 | * | |
40 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
41 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
42 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
43 | * details. | |
44 | * | |
45 | * If you didn't download this code from the following link, you should check if | |
46 | * you aren't using an obsolete version: | |
47 | * http://www.lowagie.com/iText/ | |
48 | */ | |
49 | ||
50 | package com.lowagie.text.pdf; | |
51 | ||
52 | import java.util.HashMap; | |
53 | import java.util.Map; | |
54 | ||
55 | ||
56 | import com.lowagie.text.Rectangle; | |
57 | import com.lowagie.text.ExceptionConverter; | |
58 | ||
59 | /** | |
60 | * Each PDF document can contain maximum 1 AcroForm. | |
61 | */ | |
62 | ||
63 | public class PdfAcroForm extends PdfDictionary { | |
64 | ||
65 | private PdfWriter writer; | |
66 | ||
67 | ||
68 | /** This is a map containing FieldTemplates. */ | |
69 | private HashMap fieldTemplates = new HashMap(); | |
70 | ||
71 | /** This is an array containing DocumentFields. */ | |
72 | private PdfArray documentFields = new PdfArray(); | |
73 | ||
74 | /** This is an array containing the calculationorder of the fields. */ | |
75 | private PdfArray calculationOrder = new PdfArray(); | |
76 | ||
77 | /** Contains the signature flags. */ | |
78 | private int sigFlags = 0; | |
79 | ||
80 | /** Creates new PdfAcroForm | |
81 | * @param writer | |
82 | */ | |
83 | public PdfAcroForm(PdfWriter writer) { | |
84 | super(); | |
85 | this.writer = writer; | |
86 | } | |
87 | | |
88 | public void setNeedAppearances(boolean value) { | |
89 |
1
1. setNeedAppearances : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.NEEDAPPEARANCES, new PdfBoolean(value)); |
90 | } | |
91 | ||
92 | /** | |
93 | * Adds fieldTemplates. | |
94 | * @param ft | |
95 | */ | |
96 | ||
97 | public void addFieldTemplates(Map<PdfTemplate, Object> ft) { | |
98 | fieldTemplates.putAll(ft); | |
99 | } | |
100 | ||
101 | /** | |
102 | * Adds documentFields. | |
103 | * @param ref | |
104 | */ | |
105 | ||
106 | public void addDocumentField(PdfIndirectReference ref) { | |
107 | documentFields.add(ref); | |
108 | } | |
109 | ||
110 | /** | |
111 | * Checks if the Acroform is valid | |
112 | * @return true if the Acroform is valid | |
113 | */ | |
114 | ||
115 | public boolean isValid() { | |
116 |
2
1. isValid : negated conditional → NO_COVERAGE 2. isValid : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
if (documentFields.size() == 0) return false; |
117 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.FIELDS, documentFields); |
118 |
1
1. isValid : negated conditional → NO_COVERAGE |
if (sigFlags != 0) |
119 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.SIGFLAGS, new PdfNumber(sigFlags)); |
120 |
2
1. isValid : changed conditional boundary → NO_COVERAGE 2. isValid : negated conditional → NO_COVERAGE |
if (calculationOrder.size() > 0) |
121 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.CO, calculationOrder); |
122 |
2
1. isValid : negated conditional → NO_COVERAGE 2. isValid : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
if (fieldTemplates.isEmpty()) return true; |
123 | PdfDictionary dic = new PdfDictionary(); | |
124 | for (Object o : fieldTemplates.keySet()) { | |
125 | PdfTemplate template = (PdfTemplate) o; | |
126 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfFormField::mergeResources → NO_COVERAGE |
PdfFormField.mergeResources(dic, (PdfDictionary) template.getResources()); |
127 | } | |
128 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.DR, dic); |
129 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfAcroForm::put → NO_COVERAGE |
put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); |
130 | PdfDictionary fonts = (PdfDictionary)dic.get(PdfName.FONT); | |
131 |
1
1. isValid : negated conditional → NO_COVERAGE |
if (fonts != null) { |
132 |
1
1. isValid : removed call to com/lowagie/text/pdf/PdfWriter::eliminateFontSubset → NO_COVERAGE |
writer.eliminateFontSubset(fonts); |
133 | } | |
134 |
1
1. isValid : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
135 | } | |
136 | ||
137 | /** | |
138 | * Adds an object to the calculationOrder. | |
139 | * @param formField | |
140 | */ | |
141 | ||
142 | public void addCalculationOrder(PdfFormField formField) { | |
143 | calculationOrder.add(formField.getIndirectReference()); | |
144 | } | |
145 | ||
146 | /** | |
147 | * Sets the signature flags. | |
148 | * @param f | |
149 | */ | |
150 | ||
151 | public void setSigFlags(int f) { | |
152 |
1
1. setSigFlags : Replaced bitwise OR with AND → NO_COVERAGE |
sigFlags |= f; |
153 | } | |
154 | ||
155 | /** | |
156 | * Adds a formfield to the AcroForm. | |
157 | * @param formField | |
158 | */ | |
159 | ||
160 | public void addFormField(PdfFormField formField) { | |
161 | writer.addAnnotation(formField); | |
162 | } | |
163 | ||
164 | /** | |
165 | * @param name | |
166 | * @param caption | |
167 | * @param value | |
168 | * @param url | |
169 | * @param font | |
170 | * @param fontSize | |
171 | * @param llx | |
172 | * @param lly | |
173 | * @param urx | |
174 | * @param ury | |
175 | * @return a PdfFormField | |
176 | */ | |
177 | public PdfFormField addHtmlPostButton(String name, String caption, String value, String url, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
178 | PdfAction action = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_HTML_FORMAT); | |
179 | PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action); | |
180 |
1
1. addHtmlPostButton : removed call to com/lowagie/text/pdf/PdfAcroForm::setButtonParams → NO_COVERAGE |
setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, value); |
181 |
1
1. addHtmlPostButton : removed call to com/lowagie/text/pdf/PdfAcroForm::drawButton → NO_COVERAGE |
drawButton(button, caption, font, fontSize, llx, lly, urx, ury); |
182 |
1
1. addHtmlPostButton : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(button); |
183 |
1
1. addHtmlPostButton : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addHtmlPostButton to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return button; |
184 | } | |
185 | ||
186 | /** | |
187 | * @param name | |
188 | * @param caption | |
189 | * @param value | |
190 | * @param font | |
191 | * @param fontSize | |
192 | * @param llx | |
193 | * @param lly | |
194 | * @param urx | |
195 | * @param ury | |
196 | * @return a PdfFormField | |
197 | */ | |
198 | public PdfFormField addResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
199 | PdfAction action = PdfAction.createResetForm(null, 0); | |
200 | PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action); | |
201 |
1
1. addResetButton : removed call to com/lowagie/text/pdf/PdfAcroForm::setButtonParams → NO_COVERAGE |
setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, value); |
202 |
1
1. addResetButton : removed call to com/lowagie/text/pdf/PdfAcroForm::drawButton → NO_COVERAGE |
drawButton(button, caption, font, fontSize, llx, lly, urx, ury); |
203 |
1
1. addResetButton : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(button); |
204 |
1
1. addResetButton : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addResetButton to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return button; |
205 | } | |
206 | ||
207 | /** | |
208 | * @param name | |
209 | * @param value | |
210 | * @param url | |
211 | * @param appearance | |
212 | * @param llx | |
213 | * @param lly | |
214 | * @param urx | |
215 | * @param ury | |
216 | * @return a PdfFormField | |
217 | */ | |
218 | public PdfFormField addMap(String name, String value, String url, PdfContentByte appearance, float llx, float lly, float urx, float ury) { | |
219 | PdfAction action = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_HTML_FORMAT | PdfAction.SUBMIT_COORDINATES); | |
220 | PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action); | |
221 |
1
1. addMap : removed call to com/lowagie/text/pdf/PdfAcroForm::setButtonParams → NO_COVERAGE |
setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, null); |
222 |
2
1. addMap : Replaced float subtraction with addition → NO_COVERAGE 2. addMap : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance pa = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
223 |
1
1. addMap : removed call to com/lowagie/text/pdf/PdfAppearance::add → NO_COVERAGE |
pa.add(appearance); |
224 |
1
1. addMap : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
button.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa); |
225 |
1
1. addMap : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(button); |
226 |
1
1. addMap : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addMap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return button; |
227 | } | |
228 | ||
229 | /** | |
230 | * @param button | |
231 | * @param characteristics | |
232 | * @param name | |
233 | * @param value | |
234 | */ | |
235 | public void setButtonParams(PdfFormField button, int characteristics, String name, String value) { | |
236 |
1
1. setButtonParams : removed call to com/lowagie/text/pdf/PdfFormField::setButton → NO_COVERAGE |
button.setButton(characteristics); |
237 |
1
1. setButtonParams : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
button.setFlags(PdfAnnotation.FLAGS_PRINT); |
238 |
1
1. setButtonParams : removed call to com/lowagie/text/pdf/PdfFormField::setPage → NO_COVERAGE |
button.setPage(); |
239 |
1
1. setButtonParams : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
button.setFieldName(name); |
240 |
2
1. setButtonParams : negated conditional → NO_COVERAGE 2. setButtonParams : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsString → NO_COVERAGE |
if (value != null) button.setValueAsString(value); |
241 | } | |
242 | ||
243 | /** | |
244 | * @param button | |
245 | * @param caption | |
246 | * @param font | |
247 | * @param fontSize | |
248 | * @param llx | |
249 | * @param lly | |
250 | * @param urx | |
251 | * @param ury | |
252 | */ | |
253 | public void drawButton(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
254 |
2
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance pa = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
255 |
3
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfAppearance::drawButton → NO_COVERAGE |
pa.drawButton(0f, 0f, urx - llx, ury - lly, caption, font, fontSize); |
256 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
button.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa); |
257 | } | |
258 | ||
259 | /** | |
260 | * @param name | |
261 | * @param value | |
262 | * @return a PdfFormField | |
263 | */ | |
264 | public PdfFormField addHiddenField(String name, String value) { | |
265 | PdfFormField hidden = PdfFormField.createEmpty(writer); | |
266 |
1
1. addHiddenField : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
hidden.setFieldName(name); |
267 |
1
1. addHiddenField : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsName → NO_COVERAGE |
hidden.setValueAsName(value); |
268 |
1
1. addHiddenField : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(hidden); |
269 |
1
1. addHiddenField : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addHiddenField to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return hidden; |
270 | } | |
271 | ||
272 | /** | |
273 | * @param name | |
274 | * @param text | |
275 | * @param font | |
276 | * @param fontSize | |
277 | * @param llx | |
278 | * @param lly | |
279 | * @param urx | |
280 | * @param ury | |
281 | * @return a PdfFormField | |
282 | */ | |
283 | public PdfFormField addSingleLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
284 | PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.SINGLELINE, PdfFormField.PLAINTEXT, 0); | |
285 |
1
1. addSingleLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::setTextFieldParams → NO_COVERAGE |
setTextFieldParams(field, text, name, llx, lly, urx, ury); |
286 |
1
1. addSingleLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::drawSingleLineOfText → NO_COVERAGE |
drawSingleLineOfText(field, text, font, fontSize, llx, lly, urx, ury); |
287 |
1
1. addSingleLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(field); |
288 |
1
1. addSingleLineTextField : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addSingleLineTextField to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return field; |
289 | } | |
290 | ||
291 | /** | |
292 | * @param name | |
293 | * @param text | |
294 | * @param font | |
295 | * @param fontSize | |
296 | * @param llx | |
297 | * @param lly | |
298 | * @param urx | |
299 | * @param ury | |
300 | * @return a PdfFormField | |
301 | */ | |
302 | public PdfFormField addMultiLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
303 | PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.MULTILINE, PdfFormField.PLAINTEXT, 0); | |
304 |
1
1. addMultiLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::setTextFieldParams → NO_COVERAGE |
setTextFieldParams(field, text, name, llx, lly, urx, ury); |
305 |
1
1. addMultiLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::drawMultiLineOfText → NO_COVERAGE |
drawMultiLineOfText(field, text, font, fontSize, llx, lly, urx, ury); |
306 |
1
1. addMultiLineTextField : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(field); |
307 |
1
1. addMultiLineTextField : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addMultiLineTextField to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return field; |
308 | } | |
309 | ||
310 | /** | |
311 | * @param name | |
312 | * @param text | |
313 | * @param font | |
314 | * @param fontSize | |
315 | * @param llx | |
316 | * @param lly | |
317 | * @param urx | |
318 | * @param ury | |
319 | * @return PdfFormField | |
320 | */ | |
321 | public PdfFormField addSingleLinePasswordField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
322 | PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.SINGLELINE, PdfFormField.PASSWORD, 0); | |
323 |
1
1. addSingleLinePasswordField : removed call to com/lowagie/text/pdf/PdfAcroForm::setTextFieldParams → NO_COVERAGE |
setTextFieldParams(field, text, name, llx, lly, urx, ury); |
324 |
1
1. addSingleLinePasswordField : removed call to com/lowagie/text/pdf/PdfAcroForm::drawSingleLineOfText → NO_COVERAGE |
drawSingleLineOfText(field, text, font, fontSize, llx, lly, urx, ury); |
325 |
1
1. addSingleLinePasswordField : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(field); |
326 |
1
1. addSingleLinePasswordField : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addSingleLinePasswordField to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return field; |
327 | } | |
328 | ||
329 | /** | |
330 | * @param field | |
331 | * @param text | |
332 | * @param name | |
333 | * @param llx | |
334 | * @param lly | |
335 | * @param urx | |
336 | * @param ury | |
337 | */ | |
338 | public void setTextFieldParams(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury) { | |
339 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT); |
340 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsString → NO_COVERAGE |
field.setValueAsString(text); |
341 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultValueAsString → NO_COVERAGE |
field.setDefaultValueAsString(text); |
342 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
field.setFieldName(name); |
343 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT); |
344 |
1
1. setTextFieldParams : removed call to com/lowagie/text/pdf/PdfFormField::setPage → NO_COVERAGE |
field.setPage(); |
345 | } | |
346 | ||
347 | /** | |
348 | * @param field | |
349 | * @param text | |
350 | * @param font | |
351 | * @param fontSize | |
352 | * @param llx | |
353 | * @param lly | |
354 | * @param urx | |
355 | * @param ury | |
356 | */ | |
357 | public void drawSingleLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
358 |
2
1. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tp = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
359 | PdfAppearance tp2 = (PdfAppearance)tp.getDuplicate(); | |
360 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tp2.setFontAndSize(font, fontSize); |
361 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tp2.resetRGBColorFill(); |
362 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultAppearanceString → NO_COVERAGE |
field.setDefaultAppearanceString(tp2); |
363 |
3
1. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 3. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::drawTextField → NO_COVERAGE |
tp.drawTextField(0f, 0f, urx - llx, ury - lly); |
364 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::beginVariableText → NO_COVERAGE |
tp.beginVariableText(); |
365 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
tp.saveState(); |
366 |
5
1. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 3. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 4. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 5. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
tp.rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f); |
367 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::clip → NO_COVERAGE |
tp.clip(); |
368 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::newPath → NO_COVERAGE |
tp.newPath(); |
369 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::beginText → NO_COVERAGE |
tp.beginText(); |
370 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tp.setFontAndSize(font, fontSize); |
371 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tp.resetRGBColorFill(); |
372 |
5
1. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawSingleLineOfText : Replaced float division with multiplication → NO_COVERAGE 3. drawSingleLineOfText : Replaced float multiplication with division → NO_COVERAGE 4. drawSingleLineOfText : Replaced float subtraction with addition → NO_COVERAGE 5. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setTextMatrix → NO_COVERAGE |
tp.setTextMatrix(4, (ury - lly) / 2 - (fontSize * 0.3f)); |
373 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::showText → NO_COVERAGE |
tp.showText(text); |
374 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::endText → NO_COVERAGE |
tp.endText(); |
375 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
tp.restoreState(); |
376 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::endVariableText → NO_COVERAGE |
tp.endVariableText(); |
377 |
1
1. drawSingleLineOfText : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); |
378 | } | |
379 | ||
380 | /** | |
381 | * @param field | |
382 | * @param text | |
383 | * @param font | |
384 | * @param fontSize | |
385 | * @param llx | |
386 | * @param lly | |
387 | * @param urx | |
388 | * @param ury | |
389 | */ | |
390 | public void drawMultiLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
391 |
2
1. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tp = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
392 | PdfAppearance tp2 = (PdfAppearance)tp.getDuplicate(); | |
393 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tp2.setFontAndSize(font, fontSize); |
394 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tp2.resetRGBColorFill(); |
395 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultAppearanceString → NO_COVERAGE |
field.setDefaultAppearanceString(tp2); |
396 |
3
1. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 3. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::drawTextField → NO_COVERAGE |
tp.drawTextField(0f, 0f, urx - llx, ury - lly); |
397 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::beginVariableText → NO_COVERAGE |
tp.beginVariableText(); |
398 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
tp.saveState(); |
399 |
5
1. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 2. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 3. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 4. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE 5. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
tp.rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f); |
400 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::clip → NO_COVERAGE |
tp.clip(); |
401 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::newPath → NO_COVERAGE |
tp.newPath(); |
402 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::beginText → NO_COVERAGE |
tp.beginText(); |
403 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tp.setFontAndSize(font, fontSize); |
404 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tp.resetRGBColorFill(); |
405 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::setTextMatrix → NO_COVERAGE |
tp.setTextMatrix(4, 5); |
406 | java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text, "\n"); | |
407 |
1
1. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE |
float yPos = ury - lly; |
408 |
1
1. drawMultiLineOfText : negated conditional → NO_COVERAGE |
while (tokenizer.hasMoreTokens()) { |
409 |
2
1. drawMultiLineOfText : Replaced float multiplication with division → NO_COVERAGE 2. drawMultiLineOfText : Replaced float subtraction with addition → NO_COVERAGE |
yPos -= fontSize * 1.2f; |
410 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::showTextAligned → NO_COVERAGE |
tp.showTextAligned(PdfContentByte.ALIGN_LEFT, tokenizer.nextToken(), 3, yPos, 0); |
411 | } | |
412 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::endText → NO_COVERAGE |
tp.endText(); |
413 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
tp.restoreState(); |
414 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfAppearance::endVariableText → NO_COVERAGE |
tp.endVariableText(); |
415 |
1
1. drawMultiLineOfText : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); |
416 | } | |
417 | ||
418 | /** | |
419 | * @param name | |
420 | * @param value | |
421 | * @param status | |
422 | * @param llx | |
423 | * @param lly | |
424 | * @param urx | |
425 | * @param ury | |
426 | * @return a PdfFormField | |
427 | */ | |
428 | public PdfFormField addCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury) { | |
429 | PdfFormField field = PdfFormField.createCheckBox(writer); | |
430 |
1
1. addCheckBox : removed call to com/lowagie/text/pdf/PdfAcroForm::setCheckBoxParams → NO_COVERAGE |
setCheckBoxParams(field, name, value, status, llx, lly, urx, ury); |
431 |
1
1. addCheckBox : removed call to com/lowagie/text/pdf/PdfAcroForm::drawCheckBoxAppearences → NO_COVERAGE |
drawCheckBoxAppearences(field, value, llx, lly, urx, ury); |
432 |
1
1. addCheckBox : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(field); |
433 |
1
1. addCheckBox : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addCheckBox to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return field; |
434 | } | |
435 | ||
436 | /** | |
437 | * @param field | |
438 | * @param name | |
439 | * @param value | |
440 | * @param status | |
441 | * @param llx | |
442 | * @param lly | |
443 | * @param urx | |
444 | * @param ury | |
445 | */ | |
446 | public void setCheckBoxParams(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury) { | |
447 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_TOGGLE); |
448 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
field.setFieldName(name); |
449 |
1
1. setCheckBoxParams : negated conditional → NO_COVERAGE |
if (status) { |
450 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsName → NO_COVERAGE |
field.setValueAsName(value); |
451 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setAppearanceState → NO_COVERAGE |
field.setAppearanceState(value); |
452 | } | |
453 | else { | |
454 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsName → NO_COVERAGE |
field.setValueAsName("Off"); |
455 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setAppearanceState → NO_COVERAGE |
field.setAppearanceState("Off"); |
456 | } | |
457 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT); |
458 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setPage → NO_COVERAGE |
field.setPage(); |
459 |
1
1. setCheckBoxParams : removed call to com/lowagie/text/pdf/PdfFormField::setBorderStyle → NO_COVERAGE |
field.setBorderStyle(new PdfBorderDictionary(1, PdfBorderDictionary.STYLE_SOLID)); |
460 | } | |
461 | ||
462 | /** | |
463 | * @param field | |
464 | * @param value | |
465 | * @param llx | |
466 | * @param lly | |
467 | * @param urx | |
468 | * @param ury | |
469 | */ | |
470 | public void drawCheckBoxAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) { | |
471 | BaseFont font = null; | |
472 | try { | |
473 | font = BaseFont.createFont(BaseFont.ZAPFDINGBATS, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); | |
474 | } | |
475 | catch(Exception e) { | |
476 | throw new ExceptionConverter(e); | |
477 | } | |
478 |
1
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE |
float size = (ury - lly); |
479 |
2
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tpOn = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
480 | PdfAppearance tp2 = (PdfAppearance)tpOn.getDuplicate(); | |
481 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tp2.setFontAndSize(font, size); |
482 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tp2.resetRGBColorFill(); |
483 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultAppearanceString → NO_COVERAGE |
field.setDefaultAppearanceString(tp2); |
484 |
3
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::drawTextField → NO_COVERAGE |
tpOn.drawTextField(0f, 0f, urx - llx, ury - lly); |
485 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
tpOn.saveState(); |
486 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::resetRGBColorFill → NO_COVERAGE |
tpOn.resetRGBColorFill(); |
487 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::beginText → NO_COVERAGE |
tpOn.beginText(); |
488 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
tpOn.setFontAndSize(font, size); |
489 |
7
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawCheckBoxAppearences : Replaced float division with multiplication → NO_COVERAGE 3. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 4. drawCheckBoxAppearences : Replaced float division with multiplication → NO_COVERAGE 5. drawCheckBoxAppearences : Replaced float multiplication with division → NO_COVERAGE 6. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 7. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::showTextAligned → NO_COVERAGE |
tpOn.showTextAligned(PdfContentByte.ALIGN_CENTER, "4", (urx - llx) / 2, (ury - lly) / 2 - (size * 0.3f), 0); |
490 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::endText → NO_COVERAGE |
tpOn.endText(); |
491 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
tpOn.restoreState(); |
492 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn); |
493 |
2
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tpOff = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
494 |
3
1. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawCheckBoxAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::drawTextField → NO_COVERAGE |
tpOff.drawTextField(0f, 0f, urx - llx, ury - lly); |
495 |
1
1. drawCheckBoxAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff); |
496 | } | |
497 | ||
498 | /** | |
499 | * @param name | |
500 | * @param defaultValue | |
501 | * @param noToggleToOff | |
502 | * @return a PdfFormField | |
503 | */ | |
504 | public PdfFormField getRadioGroup(String name, String defaultValue, boolean noToggleToOff) { | |
505 | PdfFormField radio = PdfFormField.createRadioButton(writer, noToggleToOff); | |
506 |
1
1. getRadioGroup : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
radio.setFieldName(name); |
507 |
1
1. getRadioGroup : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsName → NO_COVERAGE |
radio.setValueAsName(defaultValue); |
508 |
1
1. getRadioGroup : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::getRadioGroup to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return radio; |
509 | } | |
510 | ||
511 | /** | |
512 | * @param radiogroup | |
513 | */ | |
514 | public void addRadioGroup(PdfFormField radiogroup) { | |
515 | addFormField(radiogroup); | |
516 | } | |
517 | ||
518 | /** | |
519 | * @param radiogroup | |
520 | * @param value | |
521 | * @param llx | |
522 | * @param lly | |
523 | * @param urx | |
524 | * @param ury | |
525 | * @return a PdfFormField | |
526 | */ | |
527 | public PdfFormField addRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury) { | |
528 | PdfFormField radio = PdfFormField.createEmpty(writer); | |
529 |
1
1. addRadioButton : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
radio.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_TOGGLE); |
530 | String name = radiogroup.get(PdfName.V).toString().substring(1); | |
531 |
1
1. addRadioButton : negated conditional → NO_COVERAGE |
if (name.equals(value)) { |
532 |
1
1. addRadioButton : removed call to com/lowagie/text/pdf/PdfFormField::setAppearanceState → NO_COVERAGE |
radio.setAppearanceState(value); |
533 | } | |
534 | else { | |
535 |
1
1. addRadioButton : removed call to com/lowagie/text/pdf/PdfFormField::setAppearanceState → NO_COVERAGE |
radio.setAppearanceState("Off"); |
536 | } | |
537 |
1
1. addRadioButton : removed call to com/lowagie/text/pdf/PdfAcroForm::drawRadioAppearences → NO_COVERAGE |
drawRadioAppearences(radio, value, llx, lly, urx, ury); |
538 |
1
1. addRadioButton : removed call to com/lowagie/text/pdf/PdfFormField::addKid → NO_COVERAGE |
radiogroup.addKid(radio); |
539 |
1
1. addRadioButton : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addRadioButton to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return radio; |
540 | } | |
541 | ||
542 | /** | |
543 | * @param field | |
544 | * @param value | |
545 | * @param llx | |
546 | * @param lly | |
547 | * @param urx | |
548 | * @param ury | |
549 | */ | |
550 | public void drawRadioAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) { | |
551 |
2
1. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tpOn = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
552 |
3
1. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawRadioAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::drawRadioField → NO_COVERAGE |
tpOn.drawRadioField(0f, 0f, urx - llx, ury - lly, true); |
553 |
1
1. drawRadioAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn); |
554 |
2
1. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tpOff = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
555 |
3
1. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawRadioAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawRadioAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::drawRadioField → NO_COVERAGE |
tpOff.drawRadioField(0f, 0f, urx - llx, ury - lly, false); |
556 |
1
1. drawRadioAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff); |
557 | } | |
558 | ||
559 | /** | |
560 | * @param name | |
561 | * @param options | |
562 | * @param defaultValue | |
563 | * @param font | |
564 | * @param fontSize | |
565 | * @param llx | |
566 | * @param lly | |
567 | * @param urx | |
568 | * @param ury | |
569 | * @return a PdfFormField | |
570 | */ | |
571 | public PdfFormField addSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
572 | PdfFormField choice = PdfFormField.createList(writer, options, 0); | |
573 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::setChoiceParams → NO_COVERAGE |
setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury); |
574 | StringBuilder text = new StringBuilder(); | |
575 | for (String option : options) { | |
576 | text.append(option).append('\n'); | |
577 | } | |
578 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::drawMultiLineOfText → NO_COVERAGE |
drawMultiLineOfText(choice, text.toString(), font, fontSize, llx, lly, urx, ury); |
579 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(choice); |
580 |
1
1. addSelectList : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addSelectList to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return choice; |
581 | } | |
582 | ||
583 | /** | |
584 | * @param name | |
585 | * @param options | |
586 | * @param defaultValue | |
587 | * @param font | |
588 | * @param fontSize | |
589 | * @param llx | |
590 | * @param lly | |
591 | * @param urx | |
592 | * @param ury | |
593 | * @return a PdfFormField | |
594 | */ | |
595 | public PdfFormField addSelectList(String name, String[][] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
596 | PdfFormField choice = PdfFormField.createList(writer, options, 0); | |
597 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::setChoiceParams → NO_COVERAGE |
setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury); |
598 | StringBuilder text = new StringBuilder(); | |
599 | for (String[] option : options) { | |
600 | text.append(option[1]).append('\n'); | |
601 | } | |
602 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::drawMultiLineOfText → NO_COVERAGE |
drawMultiLineOfText(choice, text.toString(), font, fontSize, llx, lly, urx, ury); |
603 |
1
1. addSelectList : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(choice); |
604 |
1
1. addSelectList : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addSelectList to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return choice; |
605 | } | |
606 | ||
607 | /** | |
608 | * @param name | |
609 | * @param options | |
610 | * @param defaultValue | |
611 | * @param editable | |
612 | * @param font | |
613 | * @param fontSize | |
614 | * @param llx | |
615 | * @param lly | |
616 | * @param urx | |
617 | * @param ury | |
618 | * @return a PdfFormField | |
619 | */ | |
620 | public PdfFormField addComboBox(String name, String[] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
621 | PdfFormField choice = PdfFormField.createCombo(writer, editable, options, 0); | |
622 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::setChoiceParams → NO_COVERAGE |
setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury); |
623 |
1
1. addComboBox : negated conditional → NO_COVERAGE |
if (defaultValue == null) { |
624 | defaultValue = options[0]; | |
625 | } | |
626 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::drawSingleLineOfText → NO_COVERAGE |
drawSingleLineOfText(choice, defaultValue, font, fontSize, llx, lly, urx, ury); |
627 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(choice); |
628 |
1
1. addComboBox : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addComboBox to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return choice; |
629 | } | |
630 | ||
631 | /** | |
632 | * @param name | |
633 | * @param options | |
634 | * @param defaultValue | |
635 | * @param editable | |
636 | * @param font | |
637 | * @param fontSize | |
638 | * @param llx | |
639 | * @param lly | |
640 | * @param urx | |
641 | * @param ury | |
642 | * @return a PdfFormField | |
643 | */ | |
644 | public PdfFormField addComboBox(String name, String[][] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) { | |
645 | PdfFormField choice = PdfFormField.createCombo(writer, editable, options, 0); | |
646 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::setChoiceParams → NO_COVERAGE |
setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury); |
647 | String value = null; | |
648 | for (String[] option : options) { | |
649 |
1
1. addComboBox : negated conditional → NO_COVERAGE |
if (option[0].equals(defaultValue)) { |
650 | value = option[1]; | |
651 | break; | |
652 | } | |
653 | } | |
654 |
1
1. addComboBox : negated conditional → NO_COVERAGE |
if (value == null) { |
655 | value = options[0][1]; | |
656 | } | |
657 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::drawSingleLineOfText → NO_COVERAGE |
drawSingleLineOfText(choice, value, font, fontSize, llx, lly, urx, ury); |
658 |
1
1. addComboBox : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(choice); |
659 |
1
1. addComboBox : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addComboBox to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return choice; |
660 | } | |
661 | ||
662 | /** | |
663 | * @param field | |
664 | * @param name | |
665 | * @param defaultValue | |
666 | * @param llx | |
667 | * @param lly | |
668 | * @param urx | |
669 | * @param ury | |
670 | */ | |
671 | public void setChoiceParams(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury) { | |
672 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT); |
673 |
1
1. setChoiceParams : negated conditional → NO_COVERAGE |
if (defaultValue != null) { |
674 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setValueAsString → NO_COVERAGE |
field.setValueAsString(defaultValue); |
675 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultValueAsString → NO_COVERAGE |
field.setDefaultValueAsString(defaultValue); |
676 | } | |
677 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
field.setFieldName(name); |
678 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT); |
679 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setPage → NO_COVERAGE |
field.setPage(); |
680 |
1
1. setChoiceParams : removed call to com/lowagie/text/pdf/PdfFormField::setBorderStyle → NO_COVERAGE |
field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID)); |
681 | } | |
682 | ||
683 | /** | |
684 | * @param name | |
685 | * @param llx | |
686 | * @param lly | |
687 | * @param urx | |
688 | * @param ury | |
689 | * @return a PdfFormField | |
690 | */ | |
691 | public PdfFormField addSignature(String name, | |
692 | float llx, float lly, float urx, float ury) { | |
693 | PdfFormField signature = PdfFormField.createSignature(writer); | |
694 |
1
1. addSignature : removed call to com/lowagie/text/pdf/PdfAcroForm::setSignatureParams → NO_COVERAGE |
setSignatureParams(signature, name, llx, lly, urx, ury); |
695 |
1
1. addSignature : removed call to com/lowagie/text/pdf/PdfAcroForm::drawSignatureAppearences → NO_COVERAGE |
drawSignatureAppearences(signature, llx, lly, urx, ury); |
696 |
1
1. addSignature : removed call to com/lowagie/text/pdf/PdfAcroForm::addFormField → NO_COVERAGE |
addFormField(signature); |
697 |
1
1. addSignature : mutated return of Object value for com/lowagie/text/pdf/PdfAcroForm::addSignature to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return signature; |
698 | } | |
699 | | |
700 | /** | |
701 | * @param field | |
702 | * @param name | |
703 | * @param llx | |
704 | * @param lly | |
705 | * @param urx | |
706 | * @param ury | |
707 | */ | |
708 | public void setSignatureParams(PdfFormField field, String name, | |
709 | float llx, float lly, float urx, float ury) { | |
710 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT); |
711 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
field.setFieldName(name); |
712 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT); |
713 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setPage → NO_COVERAGE |
field.setPage(); |
714 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setMKBorderColor → NO_COVERAGE |
field.setMKBorderColor(java.awt.Color.black); |
715 |
1
1. setSignatureParams : removed call to com/lowagie/text/pdf/PdfFormField::setMKBackgroundColor → NO_COVERAGE |
field.setMKBackgroundColor(java.awt.Color.white); |
716 | } | |
717 | ||
718 | /** | |
719 | * @param field | |
720 | * @param llx | |
721 | * @param lly | |
722 | * @param urx | |
723 | * @param ury | |
724 | */ | |
725 | public void drawSignatureAppearences(PdfFormField field, | |
726 | float llx, float lly, float urx, float ury) { | |
727 |
2
1. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE |
PdfAppearance tp = PdfAppearance.createAppearance(writer, urx - llx, ury - lly); |
728 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::setGrayFill → NO_COVERAGE |
tp.setGrayFill(1.0f); |
729 |
3
1. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
tp.rectangle(0, 0, urx - llx, ury - lly); |
730 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::fill → NO_COVERAGE |
tp.fill(); |
731 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::setGrayStroke → NO_COVERAGE |
tp.setGrayStroke(0); |
732 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::setLineWidth → NO_COVERAGE |
tp.setLineWidth(1); |
733 |
5
1. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 4. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 5. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
tp.rectangle(0.5f, 0.5f, urx - llx - 0.5f, ury - lly - 0.5f); |
734 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::closePathStroke → NO_COVERAGE |
tp.closePathStroke(); |
735 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
tp.saveState(); |
736 |
5
1. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 2. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 3. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 4. drawSignatureAppearences : Replaced float subtraction with addition → NO_COVERAGE 5. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
tp.rectangle(1, 1, urx - llx - 2, ury - lly - 2); |
737 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::clip → NO_COVERAGE |
tp.clip(); |
738 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::newPath → NO_COVERAGE |
tp.newPath(); |
739 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
tp.restoreState(); |
740 |
1
1. drawSignatureAppearences : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); |
741 | } | |
742 | } | |
Mutations | ||
89 |
1.1 |
|
116 |
1.1 2.2 |
|
117 |
1.1 |
|
118 |
1.1 |
|
119 |
1.1 |
|
120 |
1.1 2.2 |
|
121 |
1.1 |
|
122 |
1.1 2.2 |
|
126 |
1.1 |
|
128 |
1.1 |
|
129 |
1.1 |
|
131 |
1.1 |
|
132 |
1.1 |
|
134 |
1.1 |
|
152 |
1.1 |
|
180 |
1.1 |
|
181 |
1.1 |
|
182 |
1.1 |
|
183 |
1.1 |
|
201 |
1.1 |
|
202 |
1.1 |
|
203 |
1.1 |
|
204 |
1.1 |
|
221 |
1.1 |
|
222 |
1.1 2.2 |
|
223 |
1.1 |
|
224 |
1.1 |
|
225 |
1.1 |
|
226 |
1.1 |
|
236 |
1.1 |
|
237 |
1.1 |
|
238 |
1.1 |
|
239 |
1.1 |
|
240 |
1.1 2.2 |
|
254 |
1.1 2.2 |
|
255 |
1.1 2.2 3.3 |
|
256 |
1.1 |
|
266 |
1.1 |
|
267 |
1.1 |
|
268 |
1.1 |
|
269 |
1.1 |
|
285 |
1.1 |
|
286 |
1.1 |
|
287 |
1.1 |
|
288 |
1.1 |
|
304 |
1.1 |
|
305 |
1.1 |
|
306 |
1.1 |
|
307 |
1.1 |
|
323 |
1.1 |
|
324 |
1.1 |
|
325 |
1.1 |
|
326 |
1.1 |
|
339 |
1.1 |
|
340 |
1.1 |
|
341 |
1.1 |
|
342 |
1.1 |
|
343 |
1.1 |
|
344 |
1.1 |
|
358 |
1.1 2.2 |
|
360 |
1.1 |
|
361 |
1.1 |
|
362 |
1.1 |
|
363 |
1.1 2.2 3.3 |
|
364 |
1.1 |
|
365 |
1.1 |
|
366 |
1.1 2.2 3.3 4.4 5.5 |
|
367 |
1.1 |
|
368 |
1.1 |
|
369 |
1.1 |
|
370 |
1.1 |
|
371 |
1.1 |
|
372 |
1.1 2.2 3.3 4.4 5.5 |
|
373 |
1.1 |
|
374 |
1.1 |
|
375 |
1.1 |
|
376 |
1.1 |
|
377 |
1.1 |
|
391 |
1.1 2.2 |
|
393 |
1.1 |
|
394 |
1.1 |
|
395 |
1.1 |
|
396 |
1.1 2.2 3.3 |
|
397 |
1.1 |
|
398 |
1.1 |
|
399 |
1.1 2.2 3.3 4.4 5.5 |
|
400 |
1.1 |
|
401 |
1.1 |
|
402 |
1.1 |
|
403 |
1.1 |
|
404 |
1.1 |
|
405 |
1.1 |
|
407 |
1.1 |
|
408 |
1.1 |
|
409 |
1.1 2.2 |
|
410 |
1.1 |
|
412 |
1.1 |
|
413 |
1.1 |
|
414 |
1.1 |
|
415 |
1.1 |
|
430 |
1.1 |
|
431 |
1.1 |
|
432 |
1.1 |
|
433 |
1.1 |
|
447 |
1.1 |
|
448 |
1.1 |
|
449 |
1.1 |
|
450 |
1.1 |
|
451 |
1.1 |
|
454 |
1.1 |
|
455 |
1.1 |
|
457 |
1.1 |
|
458 |
1.1 |
|
459 |
1.1 |
|
478 |
1.1 |
|
479 |
1.1 2.2 |
|
481 |
1.1 |
|
482 |
1.1 |
|
483 |
1.1 |
|
484 |
1.1 2.2 3.3 |
|
485 |
1.1 |
|
486 |
1.1 |
|
487 |
1.1 |
|
488 |
1.1 |
|
489 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |
|
490 |
1.1 |
|
491 |
1.1 |
|
492 |
1.1 |
|
493 |
1.1 2.2 |
|
494 |
1.1 2.2 3.3 |
|
495 |
1.1 |
|
506 |
1.1 |
|
507 |
1.1 |
|
508 |
1.1 |
|
529 |
1.1 |
|
531 |
1.1 |
|
532 |
1.1 |
|
535 |
1.1 |
|
537 |
1.1 |
|
538 |
1.1 |
|
539 |
1.1 |
|
551 |
1.1 2.2 |
|
552 |
1.1 2.2 3.3 |
|
553 |
1.1 |
|
554 |
1.1 2.2 |
|
555 |
1.1 2.2 3.3 |
|
556 |
1.1 |
|
573 |
1.1 |
|
578 |
1.1 |
|
579 |
1.1 |
|
580 |
1.1 |
|
597 |
1.1 |
|
602 |
1.1 |
|
603 |
1.1 |
|
604 |
1.1 |
|
622 |
1.1 |
|
623 |
1.1 |
|
626 |
1.1 |
|
627 |
1.1 |
|
628 |
1.1 |
|
646 |
1.1 |
|
649 |
1.1 |
|
654 |
1.1 |
|
657 |
1.1 |
|
658 |
1.1 |
|
659 |
1.1 |
|
672 |
1.1 |
|
673 |
1.1 |
|
674 |
1.1 |
|
675 |
1.1 |
|
677 |
1.1 |
|
678 |
1.1 |
|
679 |
1.1 |
|
680 |
1.1 |
|
694 |
1.1 |
|
695 |
1.1 |
|
696 |
1.1 |
|
697 |
1.1 |
|
710 |
1.1 |
|
711 |
1.1 |
|
712 |
1.1 |
|
713 |
1.1 |
|
714 |
1.1 |
|
715 |
1.1 |
|
727 |
1.1 2.2 |
|
728 |
1.1 |
|
729 |
1.1 2.2 3.3 |
|
730 |
1.1 |
|
731 |
1.1 |
|
732 |
1.1 |
|
733 |
1.1 2.2 3.3 4.4 5.5 |
|
734 |
1.1 |
|
735 |
1.1 |
|
736 |
1.1 2.2 3.3 4.4 5.5 |
|
737 |
1.1 |
|
738 |
1.1 |
|
739 |
1.1 |
|
740 |
1.1 |