1 | /* | |
2 | * Copyright 2003 by Paulo Soares. | |
3 | * | |
4 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
5 | * (the "License"); you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
7 | * | |
8 | * Software distributed under the License is distributed on an "AS IS" basis, | |
9 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
10 | * for the specific language governing rights and limitations under the License. | |
11 | * | |
12 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
13 | * | |
14 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
15 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
16 | * All Rights Reserved. | |
17 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
18 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
19 | * | |
20 | * Contributor(s): all the names of the contributors are added in the source code | |
21 | * where applicable. | |
22 | * | |
23 | * Alternatively, the contents of this file may be used under the terms of the | |
24 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
25 | * provisions of LGPL are applicable instead of those above. If you wish to | |
26 | * allow use of your version of this file only under the terms of the LGPL | |
27 | * License and not to allow others to use your version of this file under | |
28 | * the MPL, indicate your decision by deleting the provisions above and | |
29 | * replace them with the notice and other provisions required by the LGPL. | |
30 | * If you do not delete the provisions above, a recipient may use your version | |
31 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
32 | * | |
33 | * This library is free software; you can redistribute it and/or modify it | |
34 | * under the terms of the MPL as stated above or under the terms of the GNU | |
35 | * Library General Public License as published by the Free Software Foundation; | |
36 | * either version 2 of the License, or any later version. | |
37 | * | |
38 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
39 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
40 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
41 | * details. | |
42 | * | |
43 | * If you didn't download this code from the following link, you should check if | |
44 | * you aren't using an obsolete version: | |
45 | * http://www.lowagie.com/iText/ | |
46 | */ | |
47 | package com.lowagie.text.pdf; | |
48 | ||
49 | import java.io.IOException; | |
50 | import java.io.OutputStream; | |
51 | import java.util.*; | |
52 | ||
53 | import com.lowagie.text.error_messages.MessageLocalization; | |
54 | ||
55 | import com.lowagie.text.ExceptionConverter; | |
56 | import com.lowagie.text.pdf.AcroFields.Item; | |
57 | import org.xml.sax.SAXException; | |
58 | ||
59 | import com.lowagie.text.Document; | |
60 | import com.lowagie.text.DocumentException; | |
61 | ||
62 | import com.lowagie.text.Image; | |
63 | import com.lowagie.text.Rectangle; | |
64 | import com.lowagie.text.exceptions.BadPasswordException; | |
65 | import com.lowagie.text.pdf.collection.PdfCollection; | |
66 | import com.lowagie.text.pdf.interfaces.PdfViewerPreferences; | |
67 | import com.lowagie.text.pdf.internal.PdfViewerPreferencesImp; | |
68 | import com.lowagie.text.xml.xmp.XmpReader; | |
69 | ||
70 | class PdfStamperImp extends PdfWriter { | |
71 | HashMap readers2intrefs = new HashMap(); | |
72 | HashMap readers2file = new HashMap(); | |
73 | RandomAccessFileOrArray file; | |
74 | PdfReader reader; | |
75 | IntHashtable myXref = new IntHashtable(); | |
76 | /** Integer(page number) -> PageStamp */ | |
77 | HashMap pagesToContent = new HashMap(); | |
78 | boolean closed = false; | |
79 | /** Holds value of property rotateContents. */ | |
80 | private boolean rotateContents = true; | |
81 | protected AcroFields acroFields; | |
82 | protected boolean flat = false; | |
83 | protected boolean flatFreeText = false; | |
84 | protected int[] namePtr = {0}; | |
85 | protected Set<String> partialFlattening = new HashSet<>(); | |
86 | protected boolean useVp = false; | |
87 | protected PdfViewerPreferencesImp viewerPreferences = new PdfViewerPreferencesImp(); | |
88 | protected Map<PdfTemplate, Object> fieldTemplates = new HashMap<>(); | |
89 | protected boolean fieldsAdded = false; | |
90 | protected int sigFlags = 0; | |
91 | protected boolean append; | |
92 | protected IntHashtable marked; | |
93 | protected int initialXrefSize; | |
94 | protected PdfAction openAction; | |
95 | private boolean includeFileID = true; | |
96 | private PdfObject overrideFileId = null; | |
97 | private Calendar modificationDate = null; | |
98 | ||
99 | /** Creates new PdfStamperImp. | |
100 | * @param reader the read PDF | |
101 | * @param os the output destination | |
102 | * @param pdfVersion the new pdf version or '\0' to keep the same version as the original | |
103 | * document | |
104 | * @param append | |
105 | * @throws DocumentException on error | |
106 | * @throws IOException | |
107 | */ | |
108 | PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion, boolean append) throws DocumentException, IOException { | |
109 | super(new PdfDocument(), os); | |
110 |
1
1. |
if (!reader.isOpenedWithFullPermissions()) |
111 | throw new BadPasswordException(MessageLocalization.getComposedMessage("pdfreader.not.opened.with.owner.password")); | |
112 |
1
1. |
if (reader.isTampered()) |
113 | throw new DocumentException(MessageLocalization.getComposedMessage("the.original.document.was.reused.read.it.again.from.file")); | |
114 |
1
1. |
reader.setTampered(true); |
115 | this.reader = reader; | |
116 | file = reader.getSafeFile(); | |
117 | this.append = append; | |
118 |
1
1. |
if (append) { |
119 |
1
1. |
if (reader.isRebuilt()) |
120 | throw new DocumentException(MessageLocalization.getComposedMessage("append.mode.requires.a.document.without.errors.even.if.recovery.was.possible")); | |
121 |
1
1. |
if (reader.isEncrypted()) |
122 | crypto = new PdfEncryption(reader.getDecrypt()); | |
123 |
1
1. |
pdf_version.setAppendmode(true); |
124 |
1
1. |
file.reOpen(); |
125 | byte[] buf = new byte[8192]; | |
126 | int n; | |
127 |
2
1. 2. |
while ((n = file.read(buf)) > 0) |
128 |
1
1. |
this.os.write(buf, 0, n); |
129 |
1
1. |
file.close(); |
130 | prevxref = reader.getLastXref(); | |
131 |
1
1. |
reader.setAppendable(true); |
132 | } | |
133 | else { | |
134 |
1
1. |
if (pdfVersion == 0) |
135 |
1
1. |
super.setPdfVersion(reader.getPdfVersion()); |
136 | else | |
137 |
1
1. |
super.setPdfVersion(pdfVersion); |
138 | } | |
139 |
1
1. |
super.open(); |
140 |
1
1. |
pdf.addWriter(this); |
141 |
1
1. |
if (append) { |
142 |
1
1. |
body.setRefnum(reader.getXrefSize()); |
143 | marked = new IntHashtable(); | |
144 |
1
1. |
if (reader.isNewXrefType()) |
145 | fullCompression = true; | |
146 |
1
1. |
if (reader.isHybridXref()) |
147 | fullCompression = false; | |
148 | } | |
149 | initialXrefSize = reader.getXrefSize(); | |
150 | } | |
151 | ||
152 | void close(Map<String, String> moreInfo) throws IOException { | |
153 |
1
1. close : negated conditional → NO_COVERAGE |
if (closed) |
154 | return; | |
155 |
1
1. close : negated conditional → NO_COVERAGE |
if (useVp) { |
156 |
1
1. close : removed call to com/lowagie/text/pdf/PdfReader::setViewerPreferences → NO_COVERAGE |
reader.setViewerPreferences(viewerPreferences); |
157 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(reader.getTrailer().get(PdfName.ROOT)); |
158 | } | |
159 |
1
1. close : negated conditional → NO_COVERAGE |
if (flat) |
160 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::flatFields → NO_COVERAGE |
flatFields(); |
161 |
1
1. close : negated conditional → NO_COVERAGE |
if (flatFreeText) |
162 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::flatFreeTextFields → NO_COVERAGE |
flatFreeTextFields(); |
163 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::addFieldResources → NO_COVERAGE |
addFieldResources(); |
164 | PdfDictionary catalog = reader.getCatalog(); | |
165 | PdfDictionary pages = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.PAGES)); | |
166 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pages.put(PdfName.ITXT, new PdfString(Document.getRelease())); |
167 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pages); |
168 | PdfObject acroFormObject = PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), reader.getCatalog()); | |
169 |
1
1. close : negated conditional → NO_COVERAGE |
if (acroFormObject instanceof PdfDictionary) { |
170 | PdfDictionary acroForm = (PdfDictionary) acroFormObject; | |
171 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (acroFields != null && acroFields.getXfa().isChanged()) { |
172 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
173 |
1
1. close : negated conditional → NO_COVERAGE |
if (!flat) |
174 |
1
1. close : removed call to com/lowagie/text/pdf/XfaForm::setXfa → NO_COVERAGE |
acroFields.getXfa().setXfa(this); |
175 | } | |
176 |
1
1. close : negated conditional → NO_COVERAGE |
if (sigFlags != 0) { |
177 |
1
1. close : negated conditional → NO_COVERAGE |
if (acroForm != null) { |
178 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acroForm.put(PdfName.SIGFLAGS, new PdfNumber(sigFlags)); |
179 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
180 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
181 | } | |
182 | } | |
183 | } | |
184 | closed = true; | |
185 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::addSharedObjectsToBody → NO_COVERAGE |
addSharedObjectsToBody(); |
186 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::setOutlines → NO_COVERAGE |
setOutlines(); |
187 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::setJavaScript → NO_COVERAGE |
setJavaScript(); |
188 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::addFileAttachments → NO_COVERAGE |
addFileAttachments(); |
189 |
1
1. close : negated conditional → NO_COVERAGE |
if (openAction != null) { |
190 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.OPENACTION, openAction); |
191 | } | |
192 |
1
1. close : negated conditional → NO_COVERAGE |
if (pdf.pageLabels != null) |
193 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.PAGELABELS, pdf.pageLabels.getDictionary(this)); |
194 | // OCG | |
195 |
1
1. close : negated conditional → NO_COVERAGE |
if (!documentOCG.isEmpty()) { |
196 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::fillOCProperties → NO_COVERAGE |
fillOCProperties(false); |
197 | PdfDictionary ocdict = catalog.getAsDict(PdfName.OCPROPERTIES); | |
198 |
1
1. close : negated conditional → NO_COVERAGE |
if (ocdict == null) { |
199 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
reader.getCatalog().put(PdfName.OCPROPERTIES, OCProperties); |
200 | } | |
201 | else { | |
202 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ocdict.put(PdfName.OCGS, OCProperties.get(PdfName.OCGS)); |
203 | PdfDictionary ddict = ocdict.getAsDict(PdfName.D); | |
204 |
1
1. close : negated conditional → NO_COVERAGE |
if (ddict == null) { |
205 | ddict = new PdfDictionary(); | |
206 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ocdict.put(PdfName.D, ddict); |
207 | } | |
208 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ddict.put(PdfName.ORDER, OCProperties.getAsDict(PdfName.D).get(PdfName.ORDER)); |
209 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ddict.put(PdfName.RBGROUPS, OCProperties.getAsDict(PdfName.D).get(PdfName.RBGROUPS)); |
210 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ddict.put(PdfName.OFF, OCProperties.getAsDict(PdfName.D).get(PdfName.OFF)); |
211 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ddict.put(PdfName.AS, OCProperties.getAsDict(PdfName.D).get(PdfName.AS)); |
212 | } | |
213 | } | |
214 | // metadata | |
215 | int skipInfo = -1; | |
216 | PRIndirectReference iInfo = (PRIndirectReference)reader.getTrailer().get(PdfName.INFO); | |
217 | PdfDictionary oldInfo = (PdfDictionary)PdfReader.getPdfObject(iInfo); | |
218 | String producer = null; | |
219 |
1
1. close : negated conditional → NO_COVERAGE |
if (iInfo != null) |
220 | skipInfo = iInfo.getNumber(); | |
221 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (oldInfo != null && oldInfo.get(PdfName.PRODUCER) != null) |
222 | producer = oldInfo.getAsString(PdfName.PRODUCER).toString(); | |
223 |
1
1. close : negated conditional → NO_COVERAGE |
if (producer == null) { |
224 | producer = Document.getVersion(); | |
225 | } | |
226 |
1
1. close : negated conditional → NO_COVERAGE |
else if (!producer.contains(Document.getProduct())) { |
227 | StringBuilder buf = new StringBuilder(producer); | |
228 | buf.append("; modified using "); | |
229 | buf.append(Document.getVersion()); | |
230 | producer = buf.toString(); | |
231 | } | |
232 | // XMP | |
233 | byte[] altMetadata = null; | |
234 | PdfObject xmpo = PdfReader.getPdfObject(catalog.get(PdfName.METADATA)); | |
235 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (xmpo != null && xmpo.isStream()) { |
236 | altMetadata = PdfReader.getStreamBytesRaw((PRStream)xmpo); | |
237 | PdfReader.killIndirect(catalog.get(PdfName.METADATA)); | |
238 | } | |
239 |
1
1. close : negated conditional → NO_COVERAGE |
if (xmpMetadata != null) { |
240 | altMetadata = xmpMetadata; | |
241 | } | |
242 | // if there is XMP data to add: add it | |
243 | ||
244 | PdfDate date = null; | |
245 |
1
1. close : negated conditional → NO_COVERAGE |
if (modificationDate == null) { |
246 | date = new PdfDate(); | |
247 | } else { | |
248 | date = new PdfDate(modificationDate); | |
249 | } | |
250 | | |
251 |
1
1. close : negated conditional → NO_COVERAGE |
if (altMetadata != null) { |
252 | PdfStream xmp; | |
253 | try { | |
254 | XmpReader xmpr = new XmpReader(altMetadata); | |
255 |
1
1. close : negated conditional → NO_COVERAGE |
if (!xmpr.replace("http://ns.adobe.com/pdf/1.3/", "Producer", producer)) |
256 | xmpr.add("rdf:Description", "http://ns.adobe.com/pdf/1.3/", "pdf:Producer", producer); | |
257 |
1
1. close : negated conditional → NO_COVERAGE |
if (!xmpr.replace("http://ns.adobe.com/xap/1.0/", "ModifyDate", date.getW3CDate())) |
258 | xmpr.add("rdf:Description", "http://ns.adobe.com/xap/1.0/", "xmp:ModifyDate", date.getW3CDate()); | |
259 | xmpr.replace("http://ns.adobe.com/xap/1.0/", "MetadataDate", date.getW3CDate()); | |
260 | xmp = new PdfStream(xmpr.serializeDoc()); | |
261 | } | |
262 | catch(SAXException | IOException e) { | |
263 | xmp = new PdfStream(altMetadata); | |
264 | } | |
265 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStream::put → NO_COVERAGE |
xmp.put(PdfName.TYPE, PdfName.METADATA); |
266 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStream::put → NO_COVERAGE |
xmp.put(PdfName.SUBTYPE, PdfName.XML); |
267 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (crypto != null && !crypto.isMetadataEncrypted()) { |
268 | PdfArray ar = new PdfArray(); | |
269 | ar.add(PdfName.CRYPT); | |
270 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStream::put → NO_COVERAGE |
xmp.put(PdfName.FILTER, ar); |
271 | } | |
272 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (append && xmpo != null) { |
273 | body.add(xmp, xmpo.getIndRef()); | |
274 | } | |
275 | else { | |
276 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.METADATA, body.add(xmp).getIndirectReference()); |
277 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
278 | } | |
279 | } | |
280 | try { | |
281 |
1
1. close : removed call to com/lowagie/text/pdf/RandomAccessFileOrArray::reOpen → NO_COVERAGE |
file.reOpen(); |
282 |
1
1. close : removed call to com/lowagie/text/pdf/PdfStamperImp::alterContents → NO_COVERAGE |
alterContents(); |
283 | int rootN = ((PRIndirectReference)reader.trailer.get(PdfName.ROOT)).getNumber(); | |
284 |
1
1. close : negated conditional → NO_COVERAGE |
if (append) { |
285 | int[] keys = marked.getKeys(); | |
286 | for (int j : keys) { | |
287 | PdfObject obj = reader.getPdfObjectRelease(j); | |
288 |
4
1. close : changed conditional boundary → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE 3. close : negated conditional → NO_COVERAGE 4. close : negated conditional → NO_COVERAGE |
if (obj != null && skipInfo != j && j < initialXrefSize) { |
289 |
1
1. close : negated conditional → NO_COVERAGE |
addToBody(obj, j, j != rootN); |
290 | } | |
291 | } | |
292 |
2
1. close : changed conditional boundary → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
for (int k = initialXrefSize; k < reader.getXrefSize(); ++k) { |
293 | PdfObject obj = reader.getPdfObject(k); | |
294 |
1
1. close : negated conditional → NO_COVERAGE |
if (obj != null) { |
295 | addToBody(obj, getNewObjectNumber(reader, k, 0)); | |
296 | } | |
297 | } | |
298 | } | |
299 | else { | |
300 |
2
1. close : changed conditional boundary → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
for (int k = 1; k < reader.getXrefSize(); ++k) { |
301 | PdfObject obj = reader.getPdfObjectRelease(k); | |
302 |
2
1. close : negated conditional → NO_COVERAGE 2. close : negated conditional → NO_COVERAGE |
if (obj != null && skipInfo != k) { |
303 |
1
1. close : negated conditional → NO_COVERAGE |
addToBody(obj, getNewObjectNumber(reader, k, 0), k != rootN); |
304 | } | |
305 | } | |
306 | } | |
307 | } | |
308 | finally { | |
309 | try { | |
310 |
1
1. close : removed call to com/lowagie/text/pdf/RandomAccessFileOrArray::close → NO_COVERAGE |
file.close(); |
311 | } | |
312 | catch (Exception e) { | |
313 | // empty on purpose | |
314 | } | |
315 | } | |
316 | PdfIndirectReference encryption = null; | |
317 | PdfObject fileID = null; | |
318 |
1
1. close : negated conditional → NO_COVERAGE |
if (crypto != null) { |
319 |
1
1. close : negated conditional → NO_COVERAGE |
if (append) { |
320 | encryption = reader.getCryptoRef(); | |
321 | } | |
322 | else { | |
323 | PdfIndirectObject encryptionObject = addToBody(crypto.getEncryptionDictionary(), false); | |
324 | encryption = encryptionObject.getIndirectReference(); | |
325 | } | |
326 |
1
1. close : negated conditional → NO_COVERAGE |
if (includeFileID) fileID = crypto.getFileID(); |
327 | } | |
328 |
1
1. close : negated conditional → NO_COVERAGE |
else if (includeFileID) { |
329 |
1
1. close : negated conditional → NO_COVERAGE |
if (overrideFileId != null) { |
330 | fileID = overrideFileId; | |
331 | } else { | |
332 | fileID = PdfEncryption.createInfoId(PdfEncryption.createDocumentId()); | |
333 | } | |
334 | ||
335 | } | |
336 | PRIndirectReference iRoot = (PRIndirectReference)reader.trailer.get(PdfName.ROOT); | |
337 | PdfIndirectReference root = new PdfIndirectReference(0, getNewObjectNumber(reader, iRoot.getNumber(), 0)); | |
338 | PdfIndirectReference info = null; | |
339 | PdfDictionary newInfo = new PdfDictionary(); | |
340 |
1
1. close : negated conditional → NO_COVERAGE |
if (oldInfo != null) { |
341 | for (PdfName key : oldInfo.getKeys()) { | |
342 | PdfObject value = PdfReader.getPdfObject(oldInfo.get(key)); | |
343 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
newInfo.put(key, value); |
344 | } | |
345 | } | |
346 |
1
1. close : negated conditional → NO_COVERAGE |
if (moreInfo != null) { |
347 | for (Object o : moreInfo.entrySet()) { | |
348 | Map.Entry entry = (Map.Entry) o; | |
349 | String key = (String) entry.getKey(); | |
350 | PdfName keyName = new PdfName(key); | |
351 | String value = (String) entry.getValue(); | |
352 |
1
1. close : negated conditional → NO_COVERAGE |
if (value == null) |
353 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
newInfo.remove(keyName); |
354 | else | |
355 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
newInfo.put(keyName, new PdfString(value, PdfObject.TEXT_UNICODE)); |
356 | } | |
357 | } | |
358 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
newInfo.put(PdfName.MODDATE, date); |
359 |
1
1. close : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
newInfo.put(PdfName.PRODUCER, new PdfString(producer)); |
360 |
1
1. close : negated conditional → NO_COVERAGE |
if (append) { |
361 |
1
1. close : negated conditional → NO_COVERAGE |
if (iInfo == null) |
362 | info = addToBody(newInfo, false).getIndirectReference(); | |
363 | else | |
364 | info = addToBody(newInfo, iInfo.getNumber(), false).getIndirectReference(); | |
365 | } | |
366 | else { | |
367 | info = addToBody(newInfo, false).getIndirectReference(); | |
368 | } | |
369 | // write the cross-reference table of the body | |
370 |
1
1. close : removed call to com/lowagie/text/pdf/PdfWriter$PdfBody::writeCrossReferenceTable → NO_COVERAGE |
body.writeCrossReferenceTable(os, root, info, encryption, fileID, prevxref); |
371 |
1
1. close : negated conditional → NO_COVERAGE |
if (fullCompression) { |
372 |
1
1. close : removed call to com/lowagie/text/pdf/OutputStreamCounter::write → NO_COVERAGE |
os.write(getISOBytes("startxref\n")); |
373 |
1
1. close : removed call to com/lowagie/text/pdf/OutputStreamCounter::write → NO_COVERAGE |
os.write(getISOBytes(String.valueOf(body.offset()))); |
374 |
1
1. close : removed call to com/lowagie/text/pdf/OutputStreamCounter::write → NO_COVERAGE |
os.write(getISOBytes("\n%%EOF\n")); |
375 | } | |
376 | else { | |
377 | PdfTrailer trailer = new PdfTrailer(body.size(), | |
378 | body.offset(), | |
379 | root, | |
380 | info, | |
381 | encryption, | |
382 | fileID, prevxref); | |
383 |
1
1. close : removed call to com/lowagie/text/pdf/PdfWriter$PdfTrailer::toPdf → NO_COVERAGE |
trailer.toPdf(this, os); |
384 | } | |
385 |
1
1. close : removed call to com/lowagie/text/pdf/OutputStreamCounter::flush → NO_COVERAGE |
os.flush(); |
386 |
1
1. close : negated conditional → NO_COVERAGE |
if (isCloseStream()) |
387 |
1
1. close : removed call to com/lowagie/text/pdf/OutputStreamCounter::close → NO_COVERAGE |
os.close(); |
388 |
1
1. close : removed call to com/lowagie/text/pdf/PdfReader::close → NO_COVERAGE |
reader.close(); |
389 | } | |
390 | ||
391 | void applyRotation(PdfDictionary pageN, ByteBuffer out) { | |
392 |
1
1. applyRotation : negated conditional → NO_COVERAGE |
if (!rotateContents) |
393 | return; | |
394 | Rectangle page = reader.getPageSizeWithRotation(pageN); | |
395 | int rotation = page.getRotation(); | |
396 | switch (rotation) { | |
397 | case 90: | |
398 | out.append(PdfContents.ROTATE90); | |
399 | out.append(page.getTop()); | |
400 | out.append(' ').append('0').append(PdfContents.ROTATEFINAL); | |
401 | break; | |
402 | case 180: | |
403 | out.append(PdfContents.ROTATE180); | |
404 | out.append(page.getRight()); | |
405 | out.append(' '); | |
406 | out.append(page.getTop()); | |
407 | out.append(PdfContents.ROTATEFINAL); | |
408 | break; | |
409 | case 270: | |
410 | out.append(PdfContents.ROTATE270); | |
411 | out.append('0').append(' '); | |
412 | out.append(page.getRight()); | |
413 | out.append(PdfContents.ROTATEFINAL); | |
414 | break; | |
415 | } | |
416 | } | |
417 | ||
418 | void alterContents() throws IOException { | |
419 | for (Object o : pagesToContent.values()) { | |
420 | PageStamp ps = (PageStamp) o; | |
421 | PdfDictionary pageN = ps.pageN; | |
422 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pageN); |
423 | PdfArray ar = null; | |
424 | PdfObject content = PdfReader.getPdfObject(pageN.get(PdfName.CONTENTS), pageN); | |
425 |
1
1. alterContents : negated conditional → NO_COVERAGE |
if (content == null) { |
426 | ar = new PdfArray(); | |
427 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pageN.put(PdfName.CONTENTS, ar); |
428 |
1
1. alterContents : negated conditional → NO_COVERAGE |
} else if (content.isArray()) { |
429 | ar = (PdfArray) content; | |
430 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(ar); |
431 |
1
1. alterContents : negated conditional → NO_COVERAGE |
} else if (content.isStream()) { |
432 | ar = new PdfArray(); | |
433 | ar.add(pageN.get(PdfName.CONTENTS)); | |
434 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pageN.put(PdfName.CONTENTS, ar); |
435 | } else { | |
436 | ar = new PdfArray(); | |
437 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pageN.put(PdfName.CONTENTS, ar); |
438 | } | |
439 | ByteBuffer out = new ByteBuffer(); | |
440 |
1
1. alterContents : negated conditional → NO_COVERAGE |
if (ps.under != null) { |
441 | out.append(PdfContents.SAVESTATE); | |
442 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStamperImp::applyRotation → NO_COVERAGE |
applyRotation(pageN, out); |
443 | out.append(ps.under.getInternalBuffer()); | |
444 | out.append(PdfContents.RESTORESTATE); | |
445 | } | |
446 |
1
1. alterContents : negated conditional → NO_COVERAGE |
if (ps.over != null) |
447 | out.append(PdfContents.SAVESTATE); | |
448 | PdfStream stream = new PdfStream(out.toByteArray()); | |
449 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStream::flateCompress → NO_COVERAGE |
stream.flateCompress(compressionLevel); |
450 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfArray::addFirst → NO_COVERAGE |
ar.addFirst(addToBody(stream).getIndirectReference()); |
451 |
1
1. alterContents : removed call to com/lowagie/text/pdf/ByteBuffer::reset → NO_COVERAGE |
out.reset(); |
452 |
1
1. alterContents : negated conditional → NO_COVERAGE |
if (ps.over != null) { |
453 | out.append(' '); | |
454 | out.append(PdfContents.RESTORESTATE); | |
455 | ByteBuffer buf = ps.over.getInternalBuffer(); | |
456 | out.append(buf.getBuffer(), 0, ps.replacePoint); | |
457 | out.append(PdfContents.SAVESTATE); | |
458 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStamperImp::applyRotation → NO_COVERAGE |
applyRotation(pageN, out); |
459 |
1
1. alterContents : Replaced integer subtraction with addition → NO_COVERAGE |
out.append(buf.getBuffer(), ps.replacePoint, buf.size() - ps.replacePoint); |
460 | out.append(PdfContents.RESTORESTATE); | |
461 | stream = new PdfStream(out.toByteArray()); | |
462 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStream::flateCompress → NO_COVERAGE |
stream.flateCompress(compressionLevel); |
463 | ar.add(addToBody(stream).getIndirectReference()); | |
464 | } | |
465 |
1
1. alterContents : removed call to com/lowagie/text/pdf/PdfStamperImp::alterResources → NO_COVERAGE |
alterResources(ps); |
466 | } | |
467 | } | |
468 | ||
469 | void alterResources(PageStamp ps) { | |
470 |
1
1. alterResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
ps.pageN.put(PdfName.RESOURCES, ps.pageResources.getResources()); |
471 | } | |
472 | ||
473 | protected int getNewObjectNumber(PdfReader reader, int number, int generation) { | |
474 | IntHashtable ref = (IntHashtable)readers2intrefs.get(reader); | |
475 |
1
1. getNewObjectNumber : negated conditional → NO_COVERAGE |
if (ref != null) { |
476 | int n = ref.get(number); | |
477 |
1
1. getNewObjectNumber : negated conditional → NO_COVERAGE |
if (n == 0) { |
478 | n = getIndirectReferenceNumber(); | |
479 | ref.put(number, n); | |
480 | } | |
481 |
1
1. getNewObjectNumber : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return n; |
482 | } | |
483 |
1
1. getNewObjectNumber : negated conditional → NO_COVERAGE |
if (currentPdfReaderInstance == null) { |
484 |
3
1. getNewObjectNumber : changed conditional boundary → NO_COVERAGE 2. getNewObjectNumber : negated conditional → NO_COVERAGE 3. getNewObjectNumber : negated conditional → NO_COVERAGE |
if (append && number < initialXrefSize) |
485 |
1
1. getNewObjectNumber : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return number; |
486 | int n = myXref.get(number); | |
487 |
1
1. getNewObjectNumber : negated conditional → NO_COVERAGE |
if (n == 0) { |
488 | n = getIndirectReferenceNumber(); | |
489 | myXref.put(number, n); | |
490 | } | |
491 |
1
1. getNewObjectNumber : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return n; |
492 | } | |
493 | else | |
494 |
1
1. getNewObjectNumber : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return currentPdfReaderInstance.getNewObjectNumber(number, generation); |
495 | } | |
496 | ||
497 | RandomAccessFileOrArray getReaderFile(PdfReader reader) { | |
498 |
1
1. getReaderFile : negated conditional → NO_COVERAGE |
if (readers2intrefs.containsKey(reader)) { |
499 | RandomAccessFileOrArray raf = (RandomAccessFileOrArray)readers2file.get(reader); | |
500 |
1
1. getReaderFile : negated conditional → NO_COVERAGE |
if (raf != null) |
501 |
1
1. getReaderFile : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getReaderFile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return raf; |
502 |
1
1. getReaderFile : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getReaderFile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return reader.getSafeFile(); |
503 | } | |
504 |
1
1. getReaderFile : negated conditional → NO_COVERAGE |
if (currentPdfReaderInstance == null) |
505 |
1
1. getReaderFile : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getReaderFile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return file; |
506 | else | |
507 |
1
1. getReaderFile : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getReaderFile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return currentPdfReaderInstance.getReaderFile(); |
508 | } | |
509 | ||
510 | /** | |
511 | * @param reader | |
512 | * @param openFile | |
513 | * @throws IOException | |
514 | */ | |
515 | public void registerReader(PdfReader reader, boolean openFile) throws IOException { | |
516 |
1
1. registerReader : negated conditional → NO_COVERAGE |
if (readers2intrefs.containsKey(reader)) |
517 | return; | |
518 | readers2intrefs.put(reader, new IntHashtable()); | |
519 |
1
1. registerReader : negated conditional → NO_COVERAGE |
if (openFile) { |
520 | RandomAccessFileOrArray raf = reader.getSafeFile(); | |
521 | readers2file.put(reader, raf); | |
522 |
1
1. registerReader : removed call to com/lowagie/text/pdf/RandomAccessFileOrArray::reOpen → NO_COVERAGE |
raf.reOpen(); |
523 | } | |
524 | } | |
525 | ||
526 | /** | |
527 | * @param reader | |
528 | */ | |
529 | public void unRegisterReader(PdfReader reader) { | |
530 |
1
1. unRegisterReader : negated conditional → NO_COVERAGE |
if (!readers2intrefs.containsKey(reader)) |
531 | return; | |
532 | readers2intrefs.remove(reader); | |
533 | RandomAccessFileOrArray raf = (RandomAccessFileOrArray)readers2file.get(reader); | |
534 |
1
1. unRegisterReader : negated conditional → NO_COVERAGE |
if (raf == null) |
535 | return; | |
536 | readers2file.remove(reader); | |
537 |
1
1. unRegisterReader : removed call to com/lowagie/text/pdf/RandomAccessFileOrArray::close → NO_COVERAGE |
try{raf.close();}catch(Exception e){} |
538 | } | |
539 | ||
540 | static void findAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits) { | |
541 |
1
1. findAllObjects : negated conditional → NO_COVERAGE |
if (obj == null) |
542 | return; | |
543 | switch (obj.type()) { | |
544 | case PdfObject.INDIRECT: | |
545 | PRIndirectReference iref = (PRIndirectReference)obj; | |
546 |
1
1. findAllObjects : negated conditional → NO_COVERAGE |
if (reader != iref.getReader()) |
547 | return; | |
548 |
1
1. findAllObjects : negated conditional → NO_COVERAGE |
if (hits.containsKey(iref.getNumber())) |
549 | return; | |
550 | hits.put(iref.getNumber(), 1); | |
551 |
1
1. findAllObjects : removed call to com/lowagie/text/pdf/PdfStamperImp::findAllObjects → NO_COVERAGE |
findAllObjects(reader, PdfReader.getPdfObject(obj), hits); |
552 | return; | |
553 | case PdfObject.ARRAY: | |
554 | PdfArray a = (PdfArray)obj; | |
555 |
2
1. findAllObjects : changed conditional boundary → NO_COVERAGE 2. findAllObjects : negated conditional → NO_COVERAGE |
for (int k = 0; k < a.size(); ++k) { |
556 |
1
1. findAllObjects : removed call to com/lowagie/text/pdf/PdfStamperImp::findAllObjects → NO_COVERAGE |
findAllObjects(reader, a.getPdfObject(k), hits); |
557 | } | |
558 | return; | |
559 | case PdfObject.DICTIONARY: | |
560 | case PdfObject.STREAM: | |
561 | PdfDictionary dic = (PdfDictionary)obj; | |
562 | for (PdfName name : dic.getKeys()) { | |
563 |
1
1. findAllObjects : removed call to com/lowagie/text/pdf/PdfStamperImp::findAllObjects → NO_COVERAGE |
findAllObjects(reader, dic.get(name), hits); |
564 | } | |
565 | return; | |
566 | } | |
567 | } | |
568 | ||
569 | /** | |
570 | * @param fdf | |
571 | * @throws IOException | |
572 | */ | |
573 | public void addComments(FdfReader fdf) throws IOException{ | |
574 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (readers2intrefs.containsKey(fdf)) |
575 | return; | |
576 | PdfDictionary catalog = fdf.getCatalog(); | |
577 | catalog = catalog.getAsDict(PdfName.FDF); | |
578 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (catalog == null) |
579 | return; | |
580 | PdfArray annots = catalog.getAsArray(PdfName.ANNOTS); | |
581 |
2
1. addComments : negated conditional → NO_COVERAGE 2. addComments : negated conditional → NO_COVERAGE |
if (annots == null || annots.size() == 0) |
582 | return; | |
583 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfStamperImp::registerReader → NO_COVERAGE |
registerReader(fdf, false); |
584 | IntHashtable hits = new IntHashtable(); | |
585 | HashMap irt = new HashMap(); | |
586 | ArrayList an = new ArrayList(); | |
587 |
2
1. addComments : changed conditional boundary → NO_COVERAGE 2. addComments : negated conditional → NO_COVERAGE |
for (int k = 0; k < annots.size(); ++k) { |
588 | PdfObject obj = annots.getPdfObject(k); | |
589 | PdfDictionary annot = (PdfDictionary)PdfReader.getPdfObject(obj); | |
590 | PdfNumber page = annot.getAsNumber(PdfName.PAGE); | |
591 |
3
1. addComments : changed conditional boundary → NO_COVERAGE 2. addComments : negated conditional → NO_COVERAGE 3. addComments : negated conditional → NO_COVERAGE |
if (page == null || page.intValue() >= reader.getNumberOfPages()) |
592 | continue; | |
593 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfStamperImp::findAllObjects → NO_COVERAGE |
findAllObjects(fdf, obj, hits); |
594 | an.add(obj); | |
595 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (obj.type() == PdfObject.INDIRECT) { |
596 | PdfObject nm = PdfReader.getPdfObject(annot.get(PdfName.NM)); | |
597 |
2
1. addComments : negated conditional → NO_COVERAGE 2. addComments : negated conditional → NO_COVERAGE |
if (nm != null && nm.type() == PdfObject.STRING) |
598 | irt.put(nm.toString(), obj); | |
599 | } | |
600 | } | |
601 | int[] arhits = hits.getKeys(); | |
602 | for (int n : arhits) { | |
603 | PdfObject obj = fdf.getPdfObject(n); | |
604 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (obj.type() == PdfObject.DICTIONARY) { |
605 | PdfObject str = PdfReader.getPdfObject(((PdfDictionary) obj).get(PdfName.IRT)); | |
606 |
2
1. addComments : negated conditional → NO_COVERAGE 2. addComments : negated conditional → NO_COVERAGE |
if (str != null && str.type() == PdfObject.STRING) { |
607 | PdfObject i = (PdfObject) irt.get(str.toString()); | |
608 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (i != null) { |
609 | PdfDictionary dic2 = new PdfDictionary(); | |
610 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfDictionary::merge → NO_COVERAGE |
dic2.merge((PdfDictionary) obj); |
611 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic2.put(PdfName.IRT, i); |
612 | obj = dic2; | |
613 | } | |
614 | } | |
615 | } | |
616 | addToBody(obj, getNewObjectNumber(fdf, n, 0)); | |
617 | } | |
618 | for (Object o : an) { | |
619 | PdfObject obj = (PdfObject) o; | |
620 | PdfDictionary annot = (PdfDictionary) PdfReader.getPdfObject(obj); | |
621 | PdfNumber page = annot.getAsNumber(PdfName.PAGE); | |
622 |
1
1. addComments : Replaced integer addition with subtraction → NO_COVERAGE |
PdfDictionary dic = reader.getPageN(page.intValue() + 1); |
623 | PdfArray annotsp = (PdfArray) PdfReader.getPdfObject(dic.get(PdfName.ANNOTS), dic); | |
624 |
1
1. addComments : negated conditional → NO_COVERAGE |
if (annotsp == null) { |
625 | annotsp = new PdfArray(); | |
626 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.ANNOTS, annotsp); |
627 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(dic); |
628 | } | |
629 |
1
1. addComments : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(annotsp); |
630 | annotsp.add(obj); | |
631 | } | |
632 | } | |
633 | ||
634 | PageStamp getPageStamp(int pageNum) { | |
635 | PdfDictionary pageN = reader.getPageN(pageNum); | |
636 | PageStamp ps = (PageStamp)pagesToContent.get(pageN); | |
637 |
1
1. getPageStamp : negated conditional → NO_COVERAGE |
if (ps == null) { |
638 | ps = new PageStamp(this, reader, pageN); | |
639 | pagesToContent.put(pageN, ps); | |
640 | } | |
641 |
1
1. getPageStamp : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getPageStamp to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ps; |
642 | } | |
643 | ||
644 | PdfContentByte getUnderContent(int pageNum) { | |
645 |
4
1. getUnderContent : changed conditional boundary → NO_COVERAGE 2. getUnderContent : changed conditional boundary → NO_COVERAGE 3. getUnderContent : negated conditional → NO_COVERAGE 4. getUnderContent : negated conditional → NO_COVERAGE |
if (pageNum < 1 || pageNum > reader.getNumberOfPages()) |
646 |
1
1. getUnderContent : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getUnderContent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
647 | PageStamp ps = getPageStamp(pageNum); | |
648 |
1
1. getUnderContent : negated conditional → NO_COVERAGE |
if (ps.under == null) |
649 | ps.under = new StampContent(this, ps); | |
650 |
1
1. getUnderContent : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getUnderContent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ps.under; |
651 | } | |
652 | ||
653 | PdfContentByte getOverContent(int pageNum) { | |
654 |
4
1. getOverContent : changed conditional boundary → NO_COVERAGE 2. getOverContent : changed conditional boundary → NO_COVERAGE 3. getOverContent : negated conditional → NO_COVERAGE 4. getOverContent : negated conditional → NO_COVERAGE |
if (pageNum < 1 || pageNum > reader.getNumberOfPages()) |
655 |
1
1. getOverContent : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getOverContent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
656 | PageStamp ps = getPageStamp(pageNum); | |
657 |
1
1. getOverContent : negated conditional → NO_COVERAGE |
if (ps.over == null) |
658 | ps.over = new StampContent(this, ps); | |
659 |
1
1. getOverContent : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getOverContent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ps.over; |
660 | } | |
661 | ||
662 | void correctAcroFieldPages(int page) { | |
663 |
1
1. correctAcroFieldPages : negated conditional → NO_COVERAGE |
if (acroFields == null) |
664 | return; | |
665 |
2
1. correctAcroFieldPages : changed conditional boundary → NO_COVERAGE 2. correctAcroFieldPages : negated conditional → NO_COVERAGE |
if (page > reader.getNumberOfPages()) |
666 | return; | |
667 | Map<String, Item> fields = acroFields.getFields(); | |
668 | for (Item item : fields.values()) { | |
669 |
3
1. correctAcroFieldPages : changed conditional boundary → NO_COVERAGE 2. correctAcroFieldPages : Changed increment from 1 to -1 → NO_COVERAGE 3. correctAcroFieldPages : negated conditional → NO_COVERAGE |
for (int k = 0; k < item.size(); ++k) { |
670 | int p = item.getPage(k); | |
671 |
2
1. correctAcroFieldPages : changed conditional boundary → NO_COVERAGE 2. correctAcroFieldPages : negated conditional → NO_COVERAGE |
if (p >= page) |
672 |
2
1. correctAcroFieldPages : Replaced integer addition with subtraction → NO_COVERAGE 2. correctAcroFieldPages : removed call to com/lowagie/text/pdf/AcroFields$Item::forcePage → NO_COVERAGE |
item.forcePage(k, p + 1); |
673 | } | |
674 | } | |
675 | } | |
676 | ||
677 | private static void moveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, String name) { | |
678 | Rectangle m = r.getBoxSize(pageImported, name); | |
679 |
1
1. moveRectangle : negated conditional → NO_COVERAGE |
if (m == null) |
680 |
1
1. moveRectangle : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
dic2.remove(key); |
681 | else | |
682 |
1
1. moveRectangle : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic2.put(key, new PdfRectangle(m)); |
683 | } | |
684 | ||
685 | void replacePage(PdfReader r, int pageImported, int pageReplaced) { | |
686 | PdfDictionary pageN = reader.getPageN(pageReplaced); | |
687 |
1
1. replacePage : negated conditional → NO_COVERAGE |
if (pagesToContent.containsKey(pageN)) |
688 | throw new IllegalStateException(MessageLocalization.getComposedMessage("this.page.cannot.be.replaced.new.content.was.already.added")); | |
689 | PdfImportedPage p = getImportedPage(r, pageImported); | |
690 | PdfDictionary dic2 = reader.getPageNRelease(pageReplaced); | |
691 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
dic2.remove(PdfName.RESOURCES); |
692 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
dic2.remove(PdfName.CONTENTS); |
693 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfStamperImp::moveRectangle → NO_COVERAGE |
moveRectangle(dic2, r, pageImported, PdfName.MEDIABOX, "media"); |
694 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfStamperImp::moveRectangle → NO_COVERAGE |
moveRectangle(dic2, r, pageImported, PdfName.CROPBOX, "crop"); |
695 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfStamperImp::moveRectangle → NO_COVERAGE |
moveRectangle(dic2, r, pageImported, PdfName.TRIMBOX, "trim"); |
696 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfStamperImp::moveRectangle → NO_COVERAGE |
moveRectangle(dic2, r, pageImported, PdfName.ARTBOX, "art"); |
697 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfStamperImp::moveRectangle → NO_COVERAGE |
moveRectangle(dic2, r, pageImported, PdfName.BLEEDBOX, "bleed"); |
698 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic2.put(PdfName.ROTATE, new PdfNumber(r.getPageRotation(pageImported))); |
699 | PdfContentByte cb = getOverContent(pageReplaced); | |
700 |
1
1. replacePage : removed call to com/lowagie/text/pdf/PdfContentByte::addTemplate → NO_COVERAGE |
cb.addTemplate(p, 0, 0); |
701 | PageStamp ps = (PageStamp)pagesToContent.get(pageN); | |
702 | ps.replacePoint = ps.over.getInternalBuffer().size(); | |
703 | } | |
704 | ||
705 | void insertPage(int pageNumber, Rectangle mediabox) { | |
706 | Rectangle media = new Rectangle(mediabox); | |
707 |
1
1. insertPage : Replaced integer modulus with multiplication → NO_COVERAGE |
int rotation = media.getRotation() % 360; |
708 | PdfDictionary page = new PdfDictionary(PdfName.PAGE); | |
709 | PdfDictionary resources = new PdfDictionary(); | |
710 | PdfArray procset = new PdfArray(); | |
711 | procset.add(PdfName.PDF); | |
712 | procset.add(PdfName.TEXT); | |
713 | procset.add(PdfName.IMAGEB); | |
714 | procset.add(PdfName.IMAGEC); | |
715 | procset.add(PdfName.IMAGEI); | |
716 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
resources.put(PdfName.PROCSET, procset); |
717 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
page.put(PdfName.RESOURCES, resources); |
718 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
page.put(PdfName.ROTATE, new PdfNumber(rotation)); |
719 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
page.put(PdfName.MEDIABOX, new PdfRectangle(media, rotation)); |
720 | PRIndirectReference pref = reader.addPdfObject(page); | |
721 | PdfDictionary parent; | |
722 | PRIndirectReference parentRef; | |
723 |
2
1. insertPage : changed conditional boundary → NO_COVERAGE 2. insertPage : negated conditional → NO_COVERAGE |
if (pageNumber > reader.getNumberOfPages()) { |
724 | PdfDictionary lastPage = reader.getPageNRelease(reader.getNumberOfPages()); | |
725 | parentRef = (PRIndirectReference)lastPage.get(PdfName.PARENT); | |
726 | parentRef = new PRIndirectReference(reader, parentRef.getNumber()); | |
727 | parent = (PdfDictionary)PdfReader.getPdfObject(parentRef); | |
728 | PdfArray kids = (PdfArray)PdfReader.getPdfObject(parent.get(PdfName.KIDS), parent); | |
729 | kids.add(pref); | |
730 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(kids); |
731 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfReader$PageRefs::insertPage → NO_COVERAGE |
reader.pageRefs.insertPage(pageNumber, pref); |
732 | } | |
733 | else { | |
734 |
2
1. insertPage : changed conditional boundary → NO_COVERAGE 2. insertPage : negated conditional → NO_COVERAGE |
if (pageNumber < 1) |
735 | pageNumber = 1; | |
736 | PdfDictionary firstPage = reader.getPageN(pageNumber); | |
737 | PRIndirectReference firstPageRef = reader.getPageOrigRef(pageNumber); | |
738 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfReader::releasePage → NO_COVERAGE |
reader.releasePage(pageNumber); |
739 | parentRef = (PRIndirectReference)firstPage.get(PdfName.PARENT); | |
740 | parentRef = new PRIndirectReference(reader, parentRef.getNumber()); | |
741 | parent = (PdfDictionary)PdfReader.getPdfObject(parentRef); | |
742 | PdfArray kids = (PdfArray)PdfReader.getPdfObject(parent.get(PdfName.KIDS), parent); | |
743 | int len = kids.size(); | |
744 | int num = firstPageRef.getNumber(); | |
745 |
3
1. insertPage : changed conditional boundary → NO_COVERAGE 2. insertPage : Changed increment from 1 to -1 → NO_COVERAGE 3. insertPage : negated conditional → NO_COVERAGE |
for (int k = 0; k < len; ++k) { |
746 | PRIndirectReference cur = (PRIndirectReference)kids.getPdfObject(k); | |
747 |
1
1. insertPage : negated conditional → NO_COVERAGE |
if (num == cur.getNumber()) { |
748 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfArray::add → NO_COVERAGE |
kids.add(k, pref); |
749 | break; | |
750 | } | |
751 | } | |
752 |
1
1. insertPage : negated conditional → NO_COVERAGE |
if (len == kids.size()) |
753 | throw new RuntimeException(MessageLocalization.getComposedMessage("internal.inconsistence")); | |
754 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(kids); |
755 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfReader$PageRefs::insertPage → NO_COVERAGE |
reader.pageRefs.insertPage(pageNumber, pref); |
756 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfStamperImp::correctAcroFieldPages → NO_COVERAGE |
correctAcroFieldPages(pageNumber); |
757 | } | |
758 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
page.put(PdfName.PARENT, parentRef); |
759 |
1
1. insertPage : negated conditional → NO_COVERAGE |
while (parent != null) { |
760 |
1
1. insertPage : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(parent); |
761 | PdfNumber count = (PdfNumber)PdfReader.getPdfObjectRelease(parent.get(PdfName.COUNT)); | |
762 |
2
1. insertPage : Replaced integer addition with subtraction → NO_COVERAGE 2. insertPage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
parent.put(PdfName.COUNT, new PdfNumber(count.intValue() + 1)); |
763 | parent = parent.getAsDict(PdfName.PARENT); | |
764 | } | |
765 | } | |
766 | ||
767 | /** Getter for property rotateContents. | |
768 | * @return Value of property rotateContents. | |
769 | * | |
770 | */ | |
771 | boolean isRotateContents() { | |
772 | return this.rotateContents; | |
773 | } | |
774 | ||
775 | /** Setter for property rotateContents. | |
776 | * @param rotateContents New value of property rotateContents. | |
777 | * | |
778 | */ | |
779 | void setRotateContents(boolean rotateContents) { | |
780 | this.rotateContents = rotateContents; | |
781 | } | |
782 | ||
783 | boolean isContentWritten() { | |
784 |
3
1. isContentWritten : changed conditional boundary → NO_COVERAGE 2. isContentWritten : negated conditional → NO_COVERAGE 3. isContentWritten : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return body.size() > 1; |
785 | } | |
786 | ||
787 | AcroFields getAcroFields() { | |
788 |
1
1. getAcroFields : negated conditional → NO_COVERAGE |
if (acroFields == null) { |
789 | acroFields = new AcroFields(reader, this); | |
790 | } | |
791 |
1
1. getAcroFields : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getAcroFields to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return acroFields; |
792 | } | |
793 | ||
794 | void setFormFlattening(boolean flat) { | |
795 | this.flat = flat; | |
796 | } | |
797 | ||
798 | void setFreeTextFlattening(boolean flat) { | |
799 | this.flatFreeText = flat; | |
800 | } | |
801 | ||
802 | boolean partialFormFlattening(String name) { | |
803 | getAcroFields(); | |
804 |
1
1. partialFormFlattening : negated conditional → NO_COVERAGE |
if (acroFields.getXfa().isXfaPresent()) |
805 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("partial.form.flattening.is.not.supported.with.xfa.forms")); | |
806 |
1
1. partialFormFlattening : negated conditional → NO_COVERAGE |
if (!acroFields.getFields().containsKey(name)) |
807 |
1
1. partialFormFlattening : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
808 | partialFlattening.add(name); | |
809 |
1
1. partialFormFlattening : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
810 | } | |
811 | ||
812 | void flatFields() { | |
813 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (append) |
814 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("field.flattening.is.not.supported.in.append.mode")); | |
815 | getAcroFields(); | |
816 | Map<String, Item> fields = acroFields.getFields(); | |
817 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (fieldsAdded && partialFlattening.isEmpty()) { |
818 | partialFlattening.addAll(fields.keySet()); | |
819 | } | |
820 | PdfDictionary acroForm = reader.getCatalog().getAsDict(PdfName.ACROFORM); | |
821 | PdfArray acroFds = null; | |
822 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (acroForm != null) { |
823 | acroFds = (PdfArray)PdfReader.getPdfObject(acroForm.get(PdfName.FIELDS), acroForm); | |
824 | } | |
825 | for (Map.Entry<String, Item> entry : fields.entrySet()) { | |
826 | String name = entry.getKey(); | |
827 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (!partialFlattening.isEmpty() && !partialFlattening.contains(name)) |
828 | continue; | |
829 | Item item = entry.getValue(); | |
830 |
3
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : Changed increment from 1 to -1 → NO_COVERAGE 3. flatFields : negated conditional → NO_COVERAGE |
for (int k = 0; k < item.size(); ++k) { |
831 | PdfDictionary merged = item.getMerged(k); | |
832 | PdfNumber ff = merged.getAsNumber(PdfName.F); | |
833 | int flags = 0; | |
834 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (ff != null) |
835 | flags = ff.intValue(); | |
836 | int page = item.getPage(k); | |
837 | PdfDictionary appDic = merged.getAsDict(PdfName.AP); | |
838 |
5
1. flatFields : Replaced bitwise AND with OR → NO_COVERAGE 2. flatFields : Replaced bitwise AND with OR → NO_COVERAGE 3. flatFields : negated conditional → NO_COVERAGE 4. flatFields : negated conditional → NO_COVERAGE 5. flatFields : negated conditional → NO_COVERAGE |
if (appDic != null && (flags & PdfFormField.FLAGS_PRINT) != 0 && (flags & PdfFormField.FLAGS_HIDDEN) == 0) { |
839 | PdfObject obj = appDic.get(PdfName.N); | |
840 | PdfAppearance app = null; | |
841 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (obj != null) { |
842 | PdfObject objReal = PdfReader.getPdfObject(obj); | |
843 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (obj instanceof PdfIndirectReference && !obj.isIndirect()) |
844 | app = new PdfAppearance((PdfIndirectReference) obj); | |
845 |
1
1. flatFields : negated conditional → NO_COVERAGE |
else if (objReal instanceof PdfStream) { |
846 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
((PdfDictionary) objReal).put(PdfName.SUBTYPE, PdfName.FORM); |
847 | app = new PdfAppearance((PdfIndirectReference) obj); | |
848 | } else { | |
849 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (objReal != null && objReal.isDictionary()) { |
850 | PdfName as = merged.getAsName(PdfName.AS); | |
851 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (as != null) { |
852 | PdfIndirectReference iref = (PdfIndirectReference) ((PdfDictionary) objReal).get(as); | |
853 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (iref != null) { |
854 | app = new PdfAppearance(iref); | |
855 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (iref.isIndirect()) { |
856 | objReal = PdfReader.getPdfObject(iref); | |
857 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
((PdfDictionary) objReal).put(PdfName.SUBTYPE, PdfName.FORM); |
858 | } | |
859 | } | |
860 | } | |
861 | } | |
862 | } | |
863 | } | |
864 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (app != null) { |
865 | Rectangle box = PdfReader.getNormalizedRectangle(merged.getAsArray(PdfName.RECT)); | |
866 | PdfContentByte cb = getOverContent(page); | |
867 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfContentByte::setLiteral → NO_COVERAGE |
cb.setLiteral("Q "); |
868 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfContentByte::addTemplate → NO_COVERAGE |
cb.addTemplate(app, box.getLeft(), box.getBottom()); |
869 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfContentByte::setLiteral → NO_COVERAGE |
cb.setLiteral("q "); |
870 | } | |
871 | } | |
872 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (partialFlattening.isEmpty()) |
873 | continue; | |
874 | PdfDictionary pageDic = reader.getPageN(page); | |
875 | PdfArray annots = pageDic.getAsArray(PdfName.ANNOTS); | |
876 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (annots == null) |
877 | continue; | |
878 |
3
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : Changed increment from 1 to -1 → NO_COVERAGE 3. flatFields : negated conditional → NO_COVERAGE |
for (int idx = 0; idx < annots.size(); ++idx) { |
879 | PdfObject ran = annots.getPdfObject(idx); | |
880 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (!ran.isIndirect()) |
881 | continue; | |
882 | PdfObject ran2 = item.getWidgetRef(k); | |
883 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (!ran2.isIndirect()) |
884 | continue; | |
885 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (((PRIndirectReference) ran).getNumber() == ((PRIndirectReference) ran2).getNumber()) { |
886 |
1
1. flatFields : Changed increment from -1 to 1 → NO_COVERAGE |
annots.remove(idx--); |
887 | PRIndirectReference wdref = (PRIndirectReference) ran2; | |
888 | while (true) { | |
889 | PdfDictionary wd = (PdfDictionary) PdfReader.getPdfObject(wdref); | |
890 | PRIndirectReference parentRef = (PRIndirectReference) wd.get(PdfName.PARENT); | |
891 | PdfReader.killIndirect(wdref); | |
892 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (parentRef == null) { // reached AcroForm |
893 |
2
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
for (int fr = 0; fr < acroFds.size(); ++fr) { |
894 | PdfObject h = acroFds.getPdfObject(fr); | |
895 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (h.isIndirect() && ((PRIndirectReference) h).getNumber() == wdref.getNumber()) { |
896 | acroFds.remove(fr); | |
897 |
1
1. flatFields : Changed increment from -1 to 1 → NO_COVERAGE |
--fr; |
898 | } | |
899 | } | |
900 | break; | |
901 | } | |
902 | PdfDictionary parent = (PdfDictionary) PdfReader.getPdfObject(parentRef); | |
903 | PdfArray kids = parent.getAsArray(PdfName.KIDS); | |
904 |
2
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
for (int fr = 0; fr < kids.size(); ++fr) { |
905 | PdfObject h = kids.getPdfObject(fr); | |
906 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (h.isIndirect() && ((PRIndirectReference) h).getNumber() == wdref.getNumber()) { |
907 | kids.remove(fr); | |
908 |
1
1. flatFields : Changed increment from -1 to 1 → NO_COVERAGE |
--fr; |
909 | } | |
910 | } | |
911 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (!kids.isEmpty()) |
912 | break; | |
913 | wdref = parentRef; | |
914 | } | |
915 | } | |
916 | } | |
917 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (annots.isEmpty()) { |
918 | PdfReader.killIndirect(pageDic.get(PdfName.ANNOTS)); | |
919 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
pageDic.remove(PdfName.ANNOTS); |
920 | } | |
921 | } | |
922 | } | |
923 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (!fieldsAdded && partialFlattening.isEmpty()) { |
924 |
3
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : Changed increment from 1 to -1 → NO_COVERAGE 3. flatFields : negated conditional → NO_COVERAGE |
for (int page = 1; page <= reader.getNumberOfPages(); ++page) { |
925 | PdfDictionary pageDic = reader.getPageN(page); | |
926 | PdfArray annots = pageDic.getAsArray(PdfName.ANNOTS); | |
927 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (annots == null) |
928 | continue; | |
929 |
2
1. flatFields : changed conditional boundary → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
for (int idx = 0; idx < annots.size(); ++idx) { |
930 | PdfObject annoto = annots.getDirectObject(idx); | |
931 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if ((annoto instanceof PdfIndirectReference) && !annoto.isIndirect()) |
932 | continue; | |
933 |
2
1. flatFields : negated conditional → NO_COVERAGE 2. flatFields : negated conditional → NO_COVERAGE |
if (!annoto.isDictionary() || PdfName.WIDGET.equals(((PdfDictionary)annoto).get(PdfName.SUBTYPE))) { |
934 | annots.remove(idx); | |
935 |
1
1. flatFields : Changed increment from -1 to 1 → NO_COVERAGE |
--idx; |
936 | } | |
937 | } | |
938 |
1
1. flatFields : negated conditional → NO_COVERAGE |
if (annots.isEmpty()) { |
939 | PdfReader.killIndirect(pageDic.get(PdfName.ANNOTS)); | |
940 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
pageDic.remove(PdfName.ANNOTS); |
941 | } | |
942 | } | |
943 |
1
1. flatFields : removed call to com/lowagie/text/pdf/PdfStamperImp::eliminateAcroformObjects → NO_COVERAGE |
eliminateAcroformObjects(); |
944 | } | |
945 | } | |
946 | ||
947 | void eliminateAcroformObjects() { | |
948 | PdfObject acro = reader.getCatalog().get(PdfName.ACROFORM); | |
949 |
1
1. eliminateAcroformObjects : negated conditional → NO_COVERAGE |
if (acro == null) |
950 | return; | |
951 | PdfDictionary acrodic = (PdfDictionary)PdfReader.getPdfObject(acro); | |
952 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfReader::killXref → NO_COVERAGE |
reader.killXref(acrodic.get(PdfName.XFA)); |
953 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
acrodic.remove(PdfName.XFA); |
954 | PdfObject iFields = acrodic.get(PdfName.FIELDS); | |
955 |
1
1. eliminateAcroformObjects : negated conditional → NO_COVERAGE |
if (iFields != null) { |
956 | PdfDictionary kids = new PdfDictionary(); | |
957 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
kids.put(PdfName.KIDS, iFields); |
958 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfStamperImp::sweepKids → NO_COVERAGE |
sweepKids(kids); |
959 | PdfReader.killIndirect(iFields); | |
960 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acrodic.put(PdfName.FIELDS, new PdfArray()); |
961 | } | |
962 |
1
1. eliminateAcroformObjects : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
acrodic.remove(PdfName.SIGFLAGS); |
963 | // PdfReader.killIndirect(acro); | |
964 | // reader.getCatalog().remove(PdfName.ACROFORM); | |
965 | } | |
966 | ||
967 | void sweepKids(PdfObject obj) { | |
968 | PdfObject oo = PdfReader.killIndirect(obj); | |
969 |
2
1. sweepKids : negated conditional → NO_COVERAGE 2. sweepKids : negated conditional → NO_COVERAGE |
if (oo == null || !oo.isDictionary()) |
970 | return; | |
971 | PdfDictionary dic = (PdfDictionary)oo; | |
972 | PdfArray kids = (PdfArray)PdfReader.killIndirect(dic.get(PdfName.KIDS)); | |
973 |
1
1. sweepKids : negated conditional → NO_COVERAGE |
if (kids == null) |
974 | return; | |
975 |
2
1. sweepKids : changed conditional boundary → NO_COVERAGE 2. sweepKids : negated conditional → NO_COVERAGE |
for (int k = 0; k < kids.size(); ++k) { |
976 |
1
1. sweepKids : removed call to com/lowagie/text/pdf/PdfStamperImp::sweepKids → NO_COVERAGE |
sweepKids(kids.getPdfObject(k)); |
977 | } | |
978 | } | |
979 | ||
980 | private void flatFreeTextFields() | |
981 | { | |
982 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (append) |
983 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("freetext.flattening.is.not.supported.in.append.mode")); | |
984 | ||
985 |
3
1. flatFreeTextFields : changed conditional boundary → NO_COVERAGE 2. flatFreeTextFields : Changed increment from 1 to -1 → NO_COVERAGE 3. flatFreeTextFields : negated conditional → NO_COVERAGE |
for (int page = 1; page <= reader.getNumberOfPages(); ++page) |
986 | { | |
987 | PdfDictionary pageDic = reader.getPageN(page); | |
988 | PdfArray annots = pageDic.getAsArray(PdfName.ANNOTS); | |
989 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (annots == null) |
990 | continue; | |
991 |
3
1. flatFreeTextFields : changed conditional boundary → NO_COVERAGE 2. flatFreeTextFields : Changed increment from 1 to -1 → NO_COVERAGE 3. flatFreeTextFields : negated conditional → NO_COVERAGE |
for (int idx = 0; idx < annots.size(); ++idx) |
992 | { | |
993 | PdfObject annoto = annots.getDirectObject(idx); | |
994 |
2
1. flatFreeTextFields : negated conditional → NO_COVERAGE 2. flatFreeTextFields : negated conditional → NO_COVERAGE |
if ((annoto instanceof PdfIndirectReference) && !annoto.isIndirect()) |
995 | continue; | |
996 | ||
997 | PdfDictionary annDic = (PdfDictionary)annoto; | |
998 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (!annDic.get(PdfName.SUBTYPE).equals(PdfName.FREETEXT)) |
999 | continue; | |
1000 | PdfNumber ff = annDic.getAsNumber(PdfName.F); | |
1001 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
int flags = (ff != null) ? ff.intValue() : 0; |
1002 | ||
1003 |
4
1. flatFreeTextFields : Replaced bitwise AND with OR → NO_COVERAGE 2. flatFreeTextFields : Replaced bitwise AND with OR → NO_COVERAGE 3. flatFreeTextFields : negated conditional → NO_COVERAGE 4. flatFreeTextFields : negated conditional → NO_COVERAGE |
if ( (flags & PdfFormField.FLAGS_PRINT) != 0 && (flags & PdfFormField.FLAGS_HIDDEN) == 0) |
1004 | { | |
1005 | PdfObject obj1 = annDic.get(PdfName.AP); | |
1006 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (obj1 == null) |
1007 | continue; | |
1008 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
PdfDictionary appDic = (obj1 instanceof PdfIndirectReference) ? |
1009 | (PdfDictionary) PdfReader.getPdfObject(obj1) : (PdfDictionary) obj1; | |
1010 | PdfObject obj = appDic.get(PdfName.N); | |
1011 | PdfAppearance app = null; | |
1012 | PdfObject objReal = PdfReader.getPdfObject(obj); | |
1013 | ||
1014 |
2
1. flatFreeTextFields : negated conditional → NO_COVERAGE 2. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (obj instanceof PdfIndirectReference && !obj.isIndirect()) |
1015 | app = new PdfAppearance((PdfIndirectReference)obj); | |
1016 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
else if (objReal instanceof PdfStream) |
1017 | { | |
1018 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
((PdfDictionary)objReal).put(PdfName.SUBTYPE, PdfName.FORM); |
1019 | app = new PdfAppearance((PdfIndirectReference)obj); | |
1020 | } | |
1021 | else | |
1022 | { | |
1023 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (objReal.isDictionary()) |
1024 | { | |
1025 | PdfName as_p = appDic.getAsName(PdfName.AS); | |
1026 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (as_p != null) |
1027 | { | |
1028 | PdfIndirectReference iref = (PdfIndirectReference)((PdfDictionary)objReal).get(as_p); | |
1029 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (iref != null) |
1030 | { | |
1031 | app = new PdfAppearance(iref); | |
1032 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (iref.isIndirect()) |
1033 | { | |
1034 | objReal = PdfReader.getPdfObject(iref); | |
1035 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
((PdfDictionary)objReal).put(PdfName.SUBTYPE, PdfName.FORM); |
1036 | } | |
1037 | } | |
1038 | } | |
1039 | } | |
1040 | } | |
1041 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (app != null) |
1042 | { | |
1043 | Rectangle box = PdfReader.getNormalizedRectangle(annDic.getAsArray(PdfName.RECT)); | |
1044 | PdfContentByte cb = getOverContent(page); | |
1045 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfContentByte::setLiteral → NO_COVERAGE |
cb.setLiteral("Q "); |
1046 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfContentByte::addTemplate → NO_COVERAGE |
cb.addTemplate(app, box.getLeft(), box.getBottom()); |
1047 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfContentByte::setLiteral → NO_COVERAGE |
cb.setLiteral("q "); |
1048 | } | |
1049 | } | |
1050 | } | |
1051 |
2
1. flatFreeTextFields : changed conditional boundary → NO_COVERAGE 2. flatFreeTextFields : negated conditional → NO_COVERAGE |
for (int idx = 0; idx < annots.size(); ++idx) |
1052 | { | |
1053 | PdfDictionary annot = annots.getAsDict(idx); | |
1054 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (annot != null) |
1055 | { | |
1056 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (PdfName.FREETEXT.equals(annot.get(PdfName.SUBTYPE))) |
1057 | { | |
1058 | annots.remove(idx); | |
1059 |
1
1. flatFreeTextFields : Changed increment from -1 to 1 → NO_COVERAGE |
--idx; |
1060 | } | |
1061 | } | |
1062 | } | |
1063 |
1
1. flatFreeTextFields : negated conditional → NO_COVERAGE |
if (annots.isEmpty()) |
1064 | { | |
1065 | PdfReader.killIndirect(pageDic.get(PdfName.ANNOTS)); | |
1066 |
1
1. flatFreeTextFields : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
pageDic.remove(PdfName.ANNOTS); |
1067 | } | |
1068 | } | |
1069 | } | |
1070 | ||
1071 | /** | |
1072 | * @see com.lowagie.text.pdf.PdfWriter#getPageReference(int) | |
1073 | */ | |
1074 | public PdfIndirectReference getPageReference(int page) { | |
1075 | PdfIndirectReference ref = reader.getPageOrigRef(page); | |
1076 |
1
1. getPageReference : negated conditional → NO_COVERAGE |
if (ref == null) |
1077 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("invalid.page.number.1", page)); | |
1078 |
1
1. getPageReference : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getPageReference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ref; |
1079 | } | |
1080 | ||
1081 | /** | |
1082 | * @see com.lowagie.text.pdf.PdfWriter#addAnnotation(com.lowagie.text.pdf.PdfAnnotation) | |
1083 | */ | |
1084 | public void addAnnotation(PdfAnnotation annot) { | |
1085 | throw new RuntimeException(MessageLocalization.getComposedMessage("unsupported.in.this.context.use.pdfstamper.addannotation")); | |
1086 | } | |
1087 | ||
1088 | void addDocumentField(PdfIndirectReference ref) { | |
1089 | PdfDictionary catalog = reader.getCatalog(); | |
1090 | PdfDictionary acroForm = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), catalog); | |
1091 |
1
1. addDocumentField : negated conditional → NO_COVERAGE |
if (acroForm == null) { |
1092 | acroForm = new PdfDictionary(); | |
1093 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.ACROFORM, acroForm); |
1094 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1095 | } | |
1096 | PdfArray fields = (PdfArray)PdfReader.getPdfObject(acroForm.get(PdfName.FIELDS), acroForm); | |
1097 |
1
1. addDocumentField : negated conditional → NO_COVERAGE |
if (fields == null) { |
1098 | fields = new PdfArray(); | |
1099 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acroForm.put(PdfName.FIELDS, fields); |
1100 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
1101 | } | |
1102 |
1
1. addDocumentField : negated conditional → NO_COVERAGE |
if (!acroForm.contains(PdfName.DA)) { |
1103 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acroForm.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); |
1104 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
1105 | } | |
1106 | fields.add(ref); | |
1107 |
1
1. addDocumentField : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(fields); |
1108 | } | |
1109 | ||
1110 | void addFieldResources() throws IOException { | |
1111 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (fieldTemplates.isEmpty()) |
1112 | return; | |
1113 | PdfDictionary catalog = reader.getCatalog(); | |
1114 | PdfDictionary acroForm = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), catalog); | |
1115 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (acroForm == null) { |
1116 | acroForm = new PdfDictionary(); | |
1117 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.ACROFORM, acroForm); |
1118 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1119 | } | |
1120 | PdfDictionary dr = (PdfDictionary)PdfReader.getPdfObject(acroForm.get(PdfName.DR), acroForm); | |
1121 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (dr == null) { |
1122 | dr = new PdfDictionary(); | |
1123 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acroForm.put(PdfName.DR, dr); |
1124 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
1125 | } | |
1126 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(dr); |
1127 | for (PdfTemplate template : fieldTemplates.keySet()) { | |
1128 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfFormField::mergeResources → NO_COVERAGE |
PdfFormField.mergeResources(dr, (PdfDictionary) template.getResources(), this); |
1129 | } | |
1130 | // if (dr.get(PdfName.ENCODING) == null) dr.put(PdfName.ENCODING, PdfName.WIN_ANSI_ENCODING); | |
1131 | PdfDictionary fonts = dr.getAsDict(PdfName.FONT); | |
1132 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (fonts == null) { |
1133 | fonts = new PdfDictionary(); | |
1134 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dr.put(PdfName.FONT, fonts); |
1135 | } | |
1136 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (!fonts.contains(PdfName.HELV)) { |
1137 | PdfDictionary dic = new PdfDictionary(PdfName.FONT); | |
1138 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.BASEFONT, PdfName.HELVETICA); |
1139 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.ENCODING, PdfName.WIN_ANSI_ENCODING); |
1140 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.NAME, PdfName.HELV); |
1141 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.SUBTYPE, PdfName.TYPE1); |
1142 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); |
1143 | } | |
1144 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (!fonts.contains(PdfName.ZADB)) { |
1145 | PdfDictionary dic = new PdfDictionary(PdfName.FONT); | |
1146 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS); |
1147 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.NAME, PdfName.ZADB); |
1148 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.SUBTYPE, PdfName.TYPE1); |
1149 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
fonts.put(PdfName.ZADB, addToBody(dic).getIndirectReference()); |
1150 | } | |
1151 |
1
1. addFieldResources : negated conditional → NO_COVERAGE |
if (acroForm.get(PdfName.DA) == null) { |
1152 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
acroForm.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); |
1153 |
1
1. addFieldResources : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(acroForm); |
1154 | } | |
1155 | } | |
1156 | ||
1157 | void expandFields(PdfFormField field, List<PdfAnnotation> annotations) { | |
1158 | annotations.add(field); | |
1159 | List<PdfFormField> kids = field.getKids(); | |
1160 |
1
1. expandFields : negated conditional → NO_COVERAGE |
if (kids != null) { |
1161 | for (PdfFormField kid : kids) { | |
1162 |
1
1. expandFields : removed call to com/lowagie/text/pdf/PdfStamperImp::expandFields → NO_COVERAGE |
expandFields(kid, annotations); |
1163 | } | |
1164 | } | |
1165 | } | |
1166 | ||
1167 | void addAnnotation(PdfAnnotation annotation, PdfDictionary pageN) { | |
1168 | try { | |
1169 | List<PdfAnnotation> annotations = new ArrayList<>(); | |
1170 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (annotation.isForm()) { |
1171 | fieldsAdded = true; | |
1172 | getAcroFields(); | |
1173 | PdfFormField field = (PdfFormField)annotation; | |
1174 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (field.getParent() != null) |
1175 | return; | |
1176 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfStamperImp::expandFields → NO_COVERAGE |
expandFields(field, annotations); |
1177 | } | |
1178 | else | |
1179 | annotations.add(annotation); | |
1180 | for (PdfAnnotation pdfAnnotation : annotations) { | |
1181 | annotation = pdfAnnotation; | |
1182 |
2
1. addAnnotation : changed conditional boundary → NO_COVERAGE 2. addAnnotation : negated conditional → NO_COVERAGE |
if (annotation.getPlaceInPage() > 0) |
1183 | pageN = reader.getPageN(annotation.getPlaceInPage()); | |
1184 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (annotation.isForm()) { |
1185 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (!annotation.isUsed()) { |
1186 | Map<PdfTemplate, Object> templates = annotation.getTemplates(); | |
1187 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (templates != null) |
1188 |
1
1. addAnnotation : removed call to java/util/Map::putAll → NO_COVERAGE |
fieldTemplates.putAll(templates); |
1189 | } | |
1190 | PdfFormField field = (PdfFormField) annotation; | |
1191 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (field.getParent() == null) |
1192 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfStamperImp::addDocumentField → NO_COVERAGE |
addDocumentField(field.getIndirectReference()); |
1193 | } | |
1194 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (annotation.isAnnotation()) { |
1195 | PdfObject pdfobj = PdfReader.getPdfObject(pageN.get(PdfName.ANNOTS), pageN); | |
1196 | PdfArray annots = null; | |
1197 |
2
1. addAnnotation : negated conditional → NO_COVERAGE 2. addAnnotation : negated conditional → NO_COVERAGE |
if (pdfobj == null || !pdfobj.isArray()) { |
1198 | annots = new PdfArray(); | |
1199 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pageN.put(PdfName.ANNOTS, annots); |
1200 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pageN); |
1201 | } else | |
1202 | annots = (PdfArray) pdfobj; | |
1203 | annots.add(annotation.getIndirectReference()); | |
1204 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(annots); |
1205 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (!annotation.isUsed()) { |
1206 | PdfRectangle rect = (PdfRectangle) annotation.get(PdfName.RECT); | |
1207 |
5
1. addAnnotation : negated conditional → NO_COVERAGE 2. addAnnotation : negated conditional → NO_COVERAGE 3. addAnnotation : negated conditional → NO_COVERAGE 4. addAnnotation : negated conditional → NO_COVERAGE 5. addAnnotation : negated conditional → NO_COVERAGE |
if (rect != null && (rect.left() != 0 || rect.right() != 0 || rect.top() != 0 || rect.bottom() != 0)) { |
1208 | int rotation = reader.getPageRotation(pageN); | |
1209 | Rectangle pageSize = reader.getPageSizeWithRotation(pageN); | |
1210 | switch (rotation) { | |
1211 | case 90: | |
1212 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfAnnotation::put → NO_COVERAGE |
annotation.put(PdfName.RECT, new PdfRectangle( |
1213 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getTop() - rect.top(), |
1214 | rect.right(), | |
1215 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getTop() - rect.bottom(), |
1216 | rect.left())); | |
1217 | break; | |
1218 | case 180: | |
1219 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfAnnotation::put → NO_COVERAGE |
annotation.put(PdfName.RECT, new PdfRectangle( |
1220 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getRight() - rect.left(), |
1221 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getTop() - rect.bottom(), |
1222 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getRight() - rect.right(), |
1223 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getTop() - rect.top())); |
1224 | break; | |
1225 | case 270: | |
1226 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfAnnotation::put → NO_COVERAGE |
annotation.put(PdfName.RECT, new PdfRectangle( |
1227 | rect.bottom(), | |
1228 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getRight() - rect.left(), |
1229 | rect.top(), | |
1230 |
1
1. addAnnotation : Replaced float subtraction with addition → NO_COVERAGE |
pageSize.getRight() - rect.right())); |
1231 | break; | |
1232 | } | |
1233 | } | |
1234 | } | |
1235 | } | |
1236 |
1
1. addAnnotation : negated conditional → NO_COVERAGE |
if (!annotation.isUsed()) { |
1237 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfAnnotation::setUsed → NO_COVERAGE |
annotation.setUsed(); |
1238 | addToBody(annotation, annotation.getIndirectReference()); | |
1239 | } | |
1240 | } | |
1241 | } | |
1242 | catch (IOException e) { | |
1243 | throw new ExceptionConverter(e); | |
1244 | } | |
1245 | } | |
1246 | ||
1247 | void addAnnotation(PdfAnnotation annot, int page) { | |
1248 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfAnnotation::setPage → NO_COVERAGE |
annot.setPage(page); |
1249 |
1
1. addAnnotation : removed call to com/lowagie/text/pdf/PdfStamperImp::addAnnotation → NO_COVERAGE |
addAnnotation(annot, reader.getPageN(page)); |
1250 | } | |
1251 | ||
1252 | private void outlineTravel(PRIndirectReference outline) { | |
1253 |
1
1. outlineTravel : negated conditional → NO_COVERAGE |
while (outline != null) { |
1254 | PdfDictionary outlineR = (PdfDictionary)PdfReader.getPdfObjectRelease(outline); | |
1255 | PRIndirectReference first = (PRIndirectReference)outlineR.get(PdfName.FIRST); | |
1256 |
1
1. outlineTravel : negated conditional → NO_COVERAGE |
if (first != null) { |
1257 |
1
1. outlineTravel : removed call to com/lowagie/text/pdf/PdfStamperImp::outlineTravel → NO_COVERAGE |
outlineTravel(first); |
1258 | } | |
1259 | PdfReader.killIndirect(outlineR.get(PdfName.DEST)); | |
1260 | PdfReader.killIndirect(outlineR.get(PdfName.A)); | |
1261 | PdfReader.killIndirect(outline); | |
1262 | outline = (PRIndirectReference)outlineR.get(PdfName.NEXT); | |
1263 | } | |
1264 | } | |
1265 | ||
1266 | void deleteOutlines() { | |
1267 | PdfDictionary catalog = reader.getCatalog(); | |
1268 | PRIndirectReference outlines = (PRIndirectReference)catalog.get(PdfName.OUTLINES); | |
1269 |
1
1. deleteOutlines : negated conditional → NO_COVERAGE |
if (outlines == null) |
1270 | return; | |
1271 |
1
1. deleteOutlines : removed call to com/lowagie/text/pdf/PdfStamperImp::outlineTravel → NO_COVERAGE |
outlineTravel(outlines); |
1272 | PdfReader.killIndirect(outlines); | |
1273 |
1
1. deleteOutlines : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
catalog.remove(PdfName.OUTLINES); |
1274 |
1
1. deleteOutlines : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1275 | } | |
1276 | ||
1277 | void setJavaScript() throws IOException { | |
1278 | HashMap djs = pdf.getDocumentLevelJS(); | |
1279 |
1
1. setJavaScript : negated conditional → NO_COVERAGE |
if (djs.isEmpty()) |
1280 | return; | |
1281 | PdfDictionary catalog = reader.getCatalog(); | |
1282 | PdfDictionary names = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.NAMES), catalog); | |
1283 |
1
1. setJavaScript : negated conditional → NO_COVERAGE |
if (names == null) { |
1284 | names = new PdfDictionary(); | |
1285 |
1
1. setJavaScript : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.NAMES, names); |
1286 |
1
1. setJavaScript : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1287 | } | |
1288 |
1
1. setJavaScript : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(names); |
1289 | PdfDictionary tree = PdfNameTree.writeTree(djs, this); | |
1290 |
1
1. setJavaScript : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
names.put(PdfName.JAVASCRIPT, addToBody(tree).getIndirectReference()); |
1291 | } | |
1292 | ||
1293 | void addFileAttachments() throws IOException { | |
1294 | HashMap fs = pdf.getDocumentFileAttachment(); | |
1295 |
1
1. addFileAttachments : negated conditional → NO_COVERAGE |
if (fs.isEmpty()) |
1296 | return; | |
1297 | PdfDictionary catalog = reader.getCatalog(); | |
1298 | PdfDictionary names = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.NAMES), catalog); | |
1299 |
1
1. addFileAttachments : negated conditional → NO_COVERAGE |
if (names == null) { |
1300 | names = new PdfDictionary(); | |
1301 |
1
1. addFileAttachments : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put(PdfName.NAMES, names); |
1302 |
1
1. addFileAttachments : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1303 | } | |
1304 |
1
1. addFileAttachments : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(names); |
1305 | HashMap old = PdfNameTree.readTree((PdfDictionary)PdfReader.getPdfObjectRelease(names.get(PdfName.EMBEDDEDFILES))); | |
1306 | for (Object o : fs.entrySet()) { | |
1307 | Map.Entry entry = (Map.Entry) o; | |
1308 | String name = (String) entry.getKey(); | |
1309 | int k = 0; | |
1310 | String nn = name; | |
1311 |
1
1. addFileAttachments : negated conditional → NO_COVERAGE |
while (old.containsKey(nn)) { |
1312 |
1
1. addFileAttachments : Changed increment from 1 to -1 → NO_COVERAGE |
++k; |
1313 | nn += " " + k; | |
1314 | } | |
1315 | old.put(nn, entry.getValue()); | |
1316 | } | |
1317 | PdfDictionary tree = PdfNameTree.writeTree(old, this); | |
1318 | // Remove old EmbeddedFiles object if preset | |
1319 | PdfObject oldEmbeddedFiles = names.get(PdfName.EMBEDDEDFILES); | |
1320 |
1
1. addFileAttachments : negated conditional → NO_COVERAGE |
if (oldEmbeddedFiles != null) { |
1321 | PdfReader.killIndirect(oldEmbeddedFiles); | |
1322 | } | |
1323 | ||
1324 | // Add new EmbeddedFiles object | |
1325 |
1
1. addFileAttachments : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
names.put(PdfName.EMBEDDEDFILES, addToBody(tree).getIndirectReference()); |
1326 | } | |
1327 | ||
1328 | /** | |
1329 | * Adds or replaces the Collection Dictionary in the Catalog. | |
1330 | * @param collection the new collection dictionary. | |
1331 | */ | |
1332 | void makePackage( PdfCollection collection ) { | |
1333 | PdfDictionary catalog = reader.getCatalog(); | |
1334 |
1
1. makePackage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
catalog.put( PdfName.COLLECTION, collection ); |
1335 | } | |
1336 | ||
1337 | void setOutlines() throws IOException { | |
1338 |
1
1. setOutlines : negated conditional → NO_COVERAGE |
if (newBookmarks == null) |
1339 | return; | |
1340 |
1
1. setOutlines : removed call to com/lowagie/text/pdf/PdfStamperImp::deleteOutlines → NO_COVERAGE |
deleteOutlines(); |
1341 |
1
1. setOutlines : negated conditional → NO_COVERAGE |
if (newBookmarks.isEmpty()) |
1342 | return; | |
1343 | PdfDictionary catalog = reader.getCatalog(); | |
1344 |
1
1. setOutlines : negated conditional → NO_COVERAGE |
boolean namedAsNames = (catalog.get(PdfName.DESTS) != null); |
1345 |
1
1. setOutlines : removed call to com/lowagie/text/pdf/PdfStamperImp::writeOutlines → NO_COVERAGE |
writeOutlines(catalog, namedAsNames); |
1346 |
1
1. setOutlines : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(catalog); |
1347 | } | |
1348 | ||
1349 | /** | |
1350 | * Sets the viewer preferences. | |
1351 | * @param preferences the viewer preferences | |
1352 | * @see PdfWriter#setViewerPreferences(int) | |
1353 | */ | |
1354 | public void setViewerPreferences(int preferences) { | |
1355 | useVp = true; | |
1356 |
1
1. setViewerPreferences : removed call to com/lowagie/text/pdf/internal/PdfViewerPreferencesImp::setViewerPreferences → NO_COVERAGE |
this.viewerPreferences.setViewerPreferences(preferences); |
1357 | } | |
1358 | ||
1359 | /** Adds a viewer preference | |
1360 | * @param key a key for a viewer preference | |
1361 | * @param value the value for the viewer preference | |
1362 | * @see PdfViewerPreferences#addViewerPreference | |
1363 | */ | |
1364 | public void addViewerPreference(PdfName key, PdfObject value) { | |
1365 | useVp = true; | |
1366 |
1
1. addViewerPreference : removed call to com/lowagie/text/pdf/internal/PdfViewerPreferencesImp::addViewerPreference → NO_COVERAGE |
this.viewerPreferences.addViewerPreference(key, value); |
1367 | } | |
1368 | ||
1369 | /** | |
1370 | * Set the signature flags. | |
1371 | * @param f the flags. This flags are ORed with current ones | |
1372 | */ | |
1373 | public void setSigFlags(int f) { | |
1374 |
1
1. setSigFlags : Replaced bitwise OR with AND → NO_COVERAGE |
sigFlags |= f; |
1375 | } | |
1376 | ||
1377 | /** Always throws an <code>UnsupportedOperationException</code>. | |
1378 | * @param actionType ignore | |
1379 | * @param action ignore | |
1380 | * @throws PdfException ignore | |
1381 | * @see PdfStamper#setPageAction(PdfName, PdfAction, int) | |
1382 | */ | |
1383 | public void setPageAction(PdfName actionType, PdfAction action) throws PdfException { | |
1384 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.setpageaction.pdfname.actiontype.pdfaction.action.int.page")); | |
1385 | } | |
1386 | ||
1387 | /** | |
1388 | * Sets the open and close page additional action. | |
1389 | * @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE> | |
1390 | * or <CODE>PdfWriter.PAGE_CLOSE</CODE> | |
1391 | * @param action the action to perform | |
1392 | * @param page the page where the action will be applied. The first page is 1 | |
1393 | * @throws PdfException if the action type is invalid | |
1394 | */ | |
1395 | void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException { | |
1396 |
2
1. setPageAction : negated conditional → NO_COVERAGE 2. setPageAction : negated conditional → NO_COVERAGE |
if (!actionType.equals(PAGE_OPEN) && !actionType.equals(PAGE_CLOSE)) |
1397 | throw new PdfException(MessageLocalization.getComposedMessage("invalid.page.additional.action.type.1", actionType.toString())); | |
1398 | PdfDictionary pg = reader.getPageN(page); | |
1399 | PdfDictionary aa = (PdfDictionary)PdfReader.getPdfObject(pg.get(PdfName.AA), pg); | |
1400 |
1
1. setPageAction : negated conditional → NO_COVERAGE |
if (aa == null) { |
1401 | aa = new PdfDictionary(); | |
1402 |
1
1. setPageAction : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pg.put(PdfName.AA, aa); |
1403 |
1
1. setPageAction : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pg); |
1404 | } | |
1405 |
1
1. setPageAction : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
aa.put(actionType, action); |
1406 |
1
1. setPageAction : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(aa); |
1407 | } | |
1408 | ||
1409 | /** | |
1410 | * Always throws an <code>UnsupportedOperationException</code>. | |
1411 | * @param seconds ignore | |
1412 | */ | |
1413 | public void setDuration(int seconds) { | |
1414 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.setpageaction.pdfname.actiontype.pdfaction.action.int.page")); | |
1415 | } | |
1416 | ||
1417 | /** | |
1418 | * Always throws an <code>UnsupportedOperationException</code>. | |
1419 | * @param transition ignore | |
1420 | */ | |
1421 | public void setTransition(PdfTransition transition) { | |
1422 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.setpageaction.pdfname.actiontype.pdfaction.action.int.page")); | |
1423 | } | |
1424 | ||
1425 | /** | |
1426 | * Sets the display duration for the page (for presentations) | |
1427 | * @param seconds the number of seconds to display the page. A negative value removes the entry | |
1428 | * @param page the page where the duration will be applied. The first page is 1 | |
1429 | */ | |
1430 | void setDuration(int seconds, int page) { | |
1431 | PdfDictionary pg = reader.getPageN(page); | |
1432 |
2
1. setDuration : changed conditional boundary → NO_COVERAGE 2. setDuration : negated conditional → NO_COVERAGE |
if (seconds < 0) |
1433 |
1
1. setDuration : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
pg.remove(PdfName.DUR); |
1434 | else | |
1435 |
1
1. setDuration : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pg.put(PdfName.DUR, new PdfNumber(seconds)); |
1436 |
1
1. setDuration : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pg); |
1437 | } | |
1438 | ||
1439 | /** | |
1440 | * Sets the transition for the page | |
1441 | * @param transition the transition object. A <code>null</code> removes the transition | |
1442 | * @param page the page where the transition will be applied. The first page is 1 | |
1443 | */ | |
1444 | void setTransition(PdfTransition transition, int page) { | |
1445 | PdfDictionary pg = reader.getPageN(page); | |
1446 |
1
1. setTransition : negated conditional → NO_COVERAGE |
if (transition == null) |
1447 |
1
1. setTransition : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
pg.remove(PdfName.TRANS); |
1448 | else | |
1449 |
1
1. setTransition : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
pg.put(PdfName.TRANS, transition.getTransitionDictionary()); |
1450 |
1
1. setTransition : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(pg); |
1451 | } | |
1452 | ||
1453 | protected void markUsed(PdfObject obj) { | |
1454 |
2
1. markUsed : negated conditional → NO_COVERAGE 2. markUsed : negated conditional → NO_COVERAGE |
if (append && obj != null) { |
1455 | PRIndirectReference ref = null; | |
1456 |
1
1. markUsed : negated conditional → NO_COVERAGE |
if (obj.type() == PdfObject.INDIRECT) |
1457 | ref = (PRIndirectReference)obj; | |
1458 | else | |
1459 | ref = obj.getIndRef(); | |
1460 |
1
1. markUsed : negated conditional → NO_COVERAGE |
if (ref != null) |
1461 | marked.put(ref.getNumber(), 1); | |
1462 | } | |
1463 | } | |
1464 | ||
1465 | protected void markUsed(int num) { | |
1466 |
1
1. markUsed : negated conditional → NO_COVERAGE |
if (append) |
1467 | marked.put(num, 1); | |
1468 | } | |
1469 | ||
1470 | /** | |
1471 | * Getter for property append. | |
1472 | * @return Value of property append. | |
1473 | */ | |
1474 | boolean isAppend() { | |
1475 | return append; | |
1476 | } | |
1477 | ||
1478 | /** Additional-actions defining the actions to be taken in | |
1479 | * response to various trigger events affecting the document | |
1480 | * as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>, | |
1481 | * <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE> | |
1482 | * and <CODE>DID_PRINT</CODE>. | |
1483 | * | |
1484 | * @param actionType the action type | |
1485 | * @param action the action to execute in response to the trigger | |
1486 | * @throws PdfException on invalid action type | |
1487 | */ | |
1488 | public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException { | |
1489 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
if (!(actionType.equals(DOCUMENT_CLOSE) || |
1490 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
actionType.equals(WILL_SAVE) || |
1491 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
actionType.equals(DID_SAVE) || |
1492 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
actionType.equals(WILL_PRINT) || |
1493 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
actionType.equals(DID_PRINT))) { |
1494 | throw new PdfException(MessageLocalization.getComposedMessage("invalid.additional.action.type.1", actionType.toString())); | |
1495 | } | |
1496 | PdfDictionary aa = reader.getCatalog().getAsDict(PdfName.AA); | |
1497 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
if (aa == null) { |
1498 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
if (action == null) |
1499 | return; | |
1500 | aa = new PdfDictionary(); | |
1501 |
1
1. setAdditionalAction : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
reader.getCatalog().put(PdfName.AA, aa); |
1502 | } | |
1503 |
1
1. setAdditionalAction : removed call to com/lowagie/text/pdf/PdfStamperImp::markUsed → NO_COVERAGE |
markUsed(aa); |
1504 |
1
1. setAdditionalAction : negated conditional → NO_COVERAGE |
if (action == null) |
1505 |
1
1. setAdditionalAction : removed call to com/lowagie/text/pdf/PdfDictionary::remove → NO_COVERAGE |
aa.remove(actionType); |
1506 | else | |
1507 |
1
1. setAdditionalAction : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
aa.put(actionType, action); |
1508 | } | |
1509 | ||
1510 | /** | |
1511 | * @see com.lowagie.text.pdf.PdfWriter#setOpenAction(com.lowagie.text.pdf.PdfAction) | |
1512 | */ | |
1513 | public void setOpenAction(PdfAction action) { | |
1514 | openAction = action; | |
1515 | } | |
1516 | ||
1517 | /** | |
1518 | * @see com.lowagie.text.pdf.PdfWriter#setOpenAction(java.lang.String) | |
1519 | */ | |
1520 | public void setOpenAction(String name) { | |
1521 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("open.actions.by.name.are.not.supported")); | |
1522 | } | |
1523 | ||
1524 | /** | |
1525 | * @see com.lowagie.text.pdf.PdfWriter#setThumbnail(com.lowagie.text.Image) | |
1526 | */ | |
1527 | public void setThumbnail(com.lowagie.text.Image image) { | |
1528 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.pdfstamper.setthumbnail")); | |
1529 | } | |
1530 | ||
1531 | void setThumbnail(Image image, int page) throws DocumentException { | |
1532 | PdfIndirectReference thumb = getImageReference(addDirectImageSimple(image)); | |
1533 |
1
1. setThumbnail : removed call to com/lowagie/text/pdf/PdfReader::resetReleasePage → NO_COVERAGE |
reader.resetReleasePage(); |
1534 | PdfDictionary dic = reader.getPageN(page); | |
1535 |
1
1. setThumbnail : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.THUMB, thumb); |
1536 |
1
1. setThumbnail : removed call to com/lowagie/text/pdf/PdfReader::resetReleasePage → NO_COVERAGE |
reader.resetReleasePage(); |
1537 | } | |
1538 | ||
1539 | public PdfContentByte getDirectContentUnder() { | |
1540 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.pdfstamper.getundercontent.or.pdfstamper.getovercontent")); | |
1541 | } | |
1542 | ||
1543 | public PdfContentByte getDirectContent() { | |
1544 | throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("use.pdfstamper.getundercontent.or.pdfstamper.getovercontent")); | |
1545 | } | |
1546 | ||
1547 | /** | |
1548 | * Reads the OCProperties dictionary from the catalog of the existing document | |
1549 | * and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter. | |
1550 | * Note that the original OCProperties of the existing document can contain more information. | |
1551 | * @since 2.1.2 | |
1552 | */ | |
1553 | protected void readOCProperties() { | |
1554 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
if (!documentOCG.isEmpty()) { |
1555 | return; | |
1556 | } | |
1557 | PdfDictionary dict = reader.getCatalog().getAsDict(PdfName.OCPROPERTIES); | |
1558 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
if (dict == null) { |
1559 | return; | |
1560 | } | |
1561 | PdfArray ocgs = dict.getAsArray(PdfName.OCGS); | |
1562 | PdfIndirectReference ref; | |
1563 | PdfLayer layer; | |
1564 | HashMap ocgmap = new HashMap(); | |
1565 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
for (Iterator i = ocgs.listIterator(); i.hasNext(); ) { |
1566 | ref = (PdfIndirectReference)i.next(); | |
1567 | layer = new PdfLayer(null); | |
1568 |
1
1. readOCProperties : removed call to com/lowagie/text/pdf/PdfLayer::setRef → NO_COVERAGE |
layer.setRef(ref); |
1569 |
1
1. readOCProperties : removed call to com/lowagie/text/pdf/PdfLayer::setOnPanel → NO_COVERAGE |
layer.setOnPanel(false); |
1570 |
1
1. readOCProperties : removed call to com/lowagie/text/pdf/PdfLayer::merge → NO_COVERAGE |
layer.merge((PdfDictionary)PdfReader.getPdfObject(ref)); |
1571 | ocgmap.put(ref.toString(), layer); | |
1572 | } | |
1573 | PdfDictionary d = dict.getAsDict(PdfName.D); | |
1574 | PdfArray off = d.getAsArray(PdfName.OFF); | |
1575 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
if (off != null) { |
1576 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
for (Iterator i = off.listIterator(); i.hasNext(); ) { |
1577 | ref = (PdfIndirectReference)i.next(); | |
1578 | layer = (PdfLayer)ocgmap.get(ref.toString()); | |
1579 |
1
1. readOCProperties : removed call to com/lowagie/text/pdf/PdfLayer::setOn → NO_COVERAGE |
layer.setOn(false); |
1580 | } | |
1581 | } | |
1582 | PdfArray order = d.getAsArray(PdfName.ORDER); | |
1583 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
if (order != null) { |
1584 |
1
1. readOCProperties : removed call to com/lowagie/text/pdf/PdfStamperImp::addOrder → NO_COVERAGE |
addOrder(null, order, ocgmap); |
1585 | } | |
1586 | documentOCG.addAll(ocgmap.values()); | |
1587 | OCGRadioGroup = d.getAsArray(PdfName.RBGROUPS); | |
1588 | OCGLocked = d.getAsArray(PdfName.LOCKED); | |
1589 |
1
1. readOCProperties : negated conditional → NO_COVERAGE |
if (OCGLocked == null) |
1590 | OCGLocked = new PdfArray(); | |
1591 | } | |
1592 | ||
1593 | /** | |
1594 | * Recursive method to reconstruct the documentOCGorder variable in the writer. | |
1595 | * @param parent a parent PdfLayer (can be null) | |
1596 | * @param arr an array possibly containing children for the parent PdfLayer | |
1597 | * @param ocgmap a HashMap with indirect reference Strings as keys and PdfLayer objects as values. | |
1598 | * @since 2.1.2 | |
1599 | */ | |
1600 | private void addOrder(PdfLayer parent, PdfArray arr, Map ocgmap) { | |
1601 | PdfObject obj; | |
1602 | PdfLayer layer; | |
1603 |
2
1. addOrder : changed conditional boundary → NO_COVERAGE 2. addOrder : negated conditional → NO_COVERAGE |
for (int i = 0; i < arr.size(); i++) { |
1604 | obj = arr.getPdfObject(i); | |
1605 |
1
1. addOrder : negated conditional → NO_COVERAGE |
if (obj.isIndirect()) { |
1606 | layer = (PdfLayer)ocgmap.get(obj.toString()); | |
1607 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfLayer::setOnPanel → NO_COVERAGE |
layer.setOnPanel(true); |
1608 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfStamperImp::registerLayer → NO_COVERAGE |
registerLayer(layer); |
1609 |
1
1. addOrder : negated conditional → NO_COVERAGE |
if (parent != null) { |
1610 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfLayer::addChild → NO_COVERAGE |
parent.addChild(layer); |
1611 | } | |
1612 |
5
1. addOrder : changed conditional boundary → NO_COVERAGE 2. addOrder : Replaced integer addition with subtraction → NO_COVERAGE 3. addOrder : Replaced integer addition with subtraction → NO_COVERAGE 4. addOrder : negated conditional → NO_COVERAGE 5. addOrder : negated conditional → NO_COVERAGE |
if (arr.size() > i + 1 && arr.getPdfObject(i + 1).isArray()) { |
1613 |
1
1. addOrder : Changed increment from 1 to -1 → NO_COVERAGE |
i++; |
1614 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfStamperImp::addOrder → NO_COVERAGE |
addOrder(layer, (PdfArray)arr.getPdfObject(i), ocgmap); |
1615 | } | |
1616 | } | |
1617 |
1
1. addOrder : negated conditional → NO_COVERAGE |
else if (obj.isArray()) { |
1618 | PdfArray sub = (PdfArray)obj; | |
1619 |
1
1. addOrder : negated conditional → NO_COVERAGE |
if (sub.isEmpty()) return; |
1620 | obj = sub.getPdfObject(0); | |
1621 |
1
1. addOrder : negated conditional → NO_COVERAGE |
if (obj.isString()) { |
1622 | layer = new PdfLayer(obj.toString()); | |
1623 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfLayer::setOnPanel → NO_COVERAGE |
layer.setOnPanel(true); |
1624 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfStamperImp::registerLayer → NO_COVERAGE |
registerLayer(layer); |
1625 |
1
1. addOrder : negated conditional → NO_COVERAGE |
if (parent != null) { |
1626 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfLayer::addChild → NO_COVERAGE |
parent.addChild(layer); |
1627 | } | |
1628 | PdfArray array = new PdfArray(); | |
1629 |
1
1. addOrder : negated conditional → NO_COVERAGE |
for (Iterator j = sub.listIterator(); j.hasNext(); ) { |
1630 | array.add((PdfObject)j.next()); | |
1631 | } | |
1632 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfStamperImp::addOrder → NO_COVERAGE |
addOrder(layer, array, ocgmap); |
1633 | } | |
1634 | else { | |
1635 |
1
1. addOrder : removed call to com/lowagie/text/pdf/PdfStamperImp::addOrder → NO_COVERAGE |
addOrder(parent, (PdfArray)obj, ocgmap); |
1636 | } | |
1637 | } | |
1638 | } | |
1639 | } | |
1640 | ||
1641 | /** | |
1642 | * Gets the PdfLayer objects in an existing document as a Map | |
1643 | * with the names/titles of the layers as keys. | |
1644 | * @return a Map with all the PdfLayers in the document (and the name/title of the layer as key) | |
1645 | * @since 2.1.2 | |
1646 | */ | |
1647 | public Map getPdfLayers() { | |
1648 |
1
1. getPdfLayers : negated conditional → NO_COVERAGE |
if (documentOCG.isEmpty()) { |
1649 |
1
1. getPdfLayers : removed call to com/lowagie/text/pdf/PdfStamperImp::readOCProperties → NO_COVERAGE |
readOCProperties(); |
1650 | } | |
1651 | HashMap map = new HashMap(); | |
1652 | PdfLayer layer; | |
1653 | String key; | |
1654 | for (Object o : documentOCG) { | |
1655 | layer = (PdfLayer) o; | |
1656 |
1
1. getPdfLayers : negated conditional → NO_COVERAGE |
if (layer.getTitle() == null) { |
1657 | key = layer.getAsString(PdfName.NAME).toString(); | |
1658 | } else { | |
1659 | key = layer.getTitle(); | |
1660 | } | |
1661 |
1
1. getPdfLayers : negated conditional → NO_COVERAGE |
if (map.containsKey(key)) { |
1662 | int seq = 2; | |
1663 | String tmp = key + "(" + seq + ")"; | |
1664 |
1
1. getPdfLayers : negated conditional → NO_COVERAGE |
while (map.containsKey(tmp)) { |
1665 |
1
1. getPdfLayers : Changed increment from 1 to -1 → NO_COVERAGE |
seq++; |
1666 | tmp = key + "(" + seq + ")"; | |
1667 | } | |
1668 | key = tmp; | |
1669 | } | |
1670 | map.put(key, layer); | |
1671 | } | |
1672 |
1
1. getPdfLayers : mutated return of Object value for com/lowagie/text/pdf/PdfStamperImp::getPdfLayers to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return map; |
1673 | } | |
1674 | ||
1675 | static class PageStamp { | |
1676 | ||
1677 | PdfDictionary pageN; | |
1678 | StampContent under; | |
1679 | StampContent over; | |
1680 | PageResources pageResources; | |
1681 | int replacePoint = 0; | |
1682 | ||
1683 | PageStamp(PdfStamperImp stamper, PdfReader reader, PdfDictionary pageN) { | |
1684 | this.pageN = pageN; | |
1685 | pageResources = new PageResources(); | |
1686 | PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); | |
1687 |
1
1. |
pageResources.setOriginalResources(resources, stamper.namePtr); |
1688 | } | |
1689 | } | |
1690 | ||
1691 | /** These methods are used by PdfStamper to override some PDF properties when signing PDF files. */ | |
1692 | ||
1693 | public boolean isIncludeFileID() { | |
1694 | return includeFileID; | |
1695 | } | |
1696 | ||
1697 | public void setIncludeFileID(boolean includeFileID) { | |
1698 | this.includeFileID = includeFileID; | |
1699 | } | |
1700 | ||
1701 | public PdfObject getOverrideFileId() { | |
1702 | return overrideFileId; | |
1703 | } | |
1704 | ||
1705 | public void setOverrideFileId(PdfObject overrideFileId) { | |
1706 | this.overrideFileId = overrideFileId; | |
1707 | } | |
1708 | | |
1709 | ||
1710 | public Calendar getModificationDate() { | |
1711 | return modificationDate; | |
1712 | } | |
1713 | ||
1714 | public void setModificationDate(Calendar modificationDate) { | |
1715 | this.modificationDate = modificationDate; | |
1716 | } | |
1717 | ||
1718 | ||
1719 | } | |
Mutations | ||
110 |
1.1 |
|
112 |
1.1 |
|
114 |
1.1 |
|
118 |
1.1 |
|
119 |
1.1 |
|
121 |
1.1 |
|
123 |
1.1 |
|
124 |
1.1 |
|
127 |
1.1 2.2 |
|
128 |
1.1 |
|
129 |
1.1 |
|
131 |
1.1 |
|
134 |
1.1 |
|
135 |
1.1 |
|
137 |
1.1 |
|
139 |
1.1 |
|
140 |
1.1 |
|
141 |
1.1 |
|
142 |
1.1 |
|
144 |
1.1 |
|
146 |
1.1 |
|
153 |
1.1 |
|
155 |
1.1 |
|
156 |
1.1 |
|
157 |
1.1 |
|
159 |
1.1 |
|
160 |
1.1 |
|
161 |
1.1 |
|
162 |
1.1 |
|
163 |
1.1 |
|
166 |
1.1 |
|
167 |
1.1 |
|
169 |
1.1 |
|
171 |
1.1 2.2 |
|
172 |
1.1 |
|
173 |
1.1 |
|
174 |
1.1 |
|
176 |
1.1 |
|
177 |
1.1 |
|
178 |
1.1 |
|
179 |
1.1 |
|
180 |
1.1 |
|
185 |
1.1 |
|
186 |
1.1 |
|
187 |
1.1 |
|
188 |
1.1 |
|
189 |
1.1 |
|
190 |
1.1 |
|
192 |
1.1 |
|
193 |
1.1 |
|
195 |
1.1 |
|
196 |
1.1 |
|
198 |
1.1 |
|
199 |
1.1 |
|
202 |
1.1 |
|
204 |
1.1 |
|
206 |
1.1 |
|
208 |
1.1 |
|
209 |
1.1 |
|
210 |
1.1 |
|
211 |
1.1 |
|
219 |
1.1 |
|
221 |
1.1 2.2 |
|
223 |
1.1 |
|
226 |
1.1 |
|
235 |
1.1 2.2 |
|
239 |
1.1 |
|
245 |
1.1 |
|
251 |
1.1 |
|
255 |
1.1 |
|
257 |
1.1 |
|
265 |
1.1 |
|
266 |
1.1 |
|
267 |
1.1 2.2 |
|
270 |
1.1 |
|
272 |
1.1 2.2 |
|
276 |
1.1 |
|
277 |
1.1 |
|
281 |
1.1 |
|
282 |
1.1 |
|
284 |
1.1 |
|
288 |
1.1 2.2 3.3 4.4 |
|
289 |
1.1 |
|
292 |
1.1 2.2 |
|
294 |
1.1 |
|
300 |
1.1 2.2 |
|
302 |
1.1 2.2 |
|
303 |
1.1 |
|
310 |
1.1 |
|
318 |
1.1 |
|
319 |
1.1 |
|
326 |
1.1 |
|
328 |
1.1 |
|
329 |
1.1 |
|
340 |
1.1 |
|
343 |
1.1 |
|
346 |
1.1 |
|
352 |
1.1 |
|
353 |
1.1 |
|
355 |
1.1 |
|
358 |
1.1 |
|
359 |
1.1 |
|
360 |
1.1 |
|
361 |
1.1 |
|
370 |
1.1 |
|
371 |
1.1 |
|
372 |
1.1 |
|
373 |
1.1 |
|
374 |
1.1 |
|
383 |
1.1 |
|
385 |
1.1 |
|
386 |
1.1 |
|
387 |
1.1 |
|
388 |
1.1 |
|
392 |
1.1 |
|
422 |
1.1 |
|
425 |
1.1 |
|
427 |
1.1 |
|
428 |
1.1 |
|
430 |
1.1 |
|
431 |
1.1 |
|
434 |
1.1 |
|
437 |
1.1 |
|
440 |
1.1 |
|
442 |
1.1 |
|
446 |
1.1 |
|
449 |
1.1 |
|
450 |
1.1 |
|
451 |
1.1 |
|
452 |
1.1 |
|
458 |
1.1 |
|
459 |
1.1 |
|
462 |
1.1 |
|
465 |
1.1 |
|
470 |
1.1 |
|
475 |
1.1 |
|
477 |
1.1 |
|
481 |
1.1 |
|
483 |
1.1 |
|
484 |
1.1 2.2 3.3 |
|
485 |
1.1 |
|
487 |
1.1 |
|
491 |
1.1 |
|
494 |
1.1 |
|
498 |
1.1 |
|
500 |
1.1 |
|
501 |
1.1 |
|
502 |
1.1 |
|
504 |
1.1 |
|
505 |
1.1 |
|
507 |
1.1 |
|
516 |
1.1 |
|
519 |
1.1 |
|
522 |
1.1 |
|
530 |
1.1 |
|
534 |
1.1 |
|
537 |
1.1 |
|
541 |
1.1 |
|
546 |
1.1 |
|
548 |
1.1 |
|
551 |
1.1 |
|
555 |
1.1 2.2 |
|
556 |
1.1 |
|
563 |
1.1 |
|
574 |
1.1 |
|
578 |
1.1 |
|
581 |
1.1 2.2 |
|
583 |
1.1 |
|
587 |
1.1 2.2 |
|
591 |
1.1 2.2 3.3 |
|
593 |
1.1 |
|
595 |
1.1 |
|
597 |
1.1 2.2 |
|
604 |
1.1 |
|
606 |
1.1 2.2 |
|
608 |
1.1 |
|
610 |
1.1 |
|
611 |
1.1 |
|
622 |
1.1 |
|
624 |
1.1 |
|
626 |
1.1 |
|
627 |
1.1 |
|
629 |
1.1 |
|
637 |
1.1 |
|
641 |
1.1 |
|
645 |
1.1 2.2 3.3 4.4 |
|
646 |
1.1 |
|
648 |
1.1 |
|
650 |
1.1 |
|
654 |
1.1 2.2 3.3 4.4 |
|
655 |
1.1 |
|
657 |
1.1 |
|
659 |
1.1 |
|
663 |
1.1 |
|
665 |
1.1 2.2 |
|
669 |
1.1 2.2 3.3 |
|
671 |
1.1 2.2 |
|
672 |
1.1 2.2 |
|
679 |
1.1 |
|
680 |
1.1 |
|
682 |
1.1 |
|
687 |
1.1 |
|
691 |
1.1 |
|
692 |
1.1 |
|
693 |
1.1 |
|
694 |
1.1 |
|
695 |
1.1 |
|
696 |
1.1 |
|
697 |
1.1 |
|
698 |
1.1 |
|
700 |
1.1 |
|
707 |
1.1 |
|
716 |
1.1 |
|
717 |
1.1 |
|
718 |
1.1 |
|
719 |
1.1 |
|
723 |
1.1 2.2 |
|
730 |
1.1 |
|
731 |
1.1 |
|
734 |
1.1 2.2 |
|
738 |
1.1 |
|
745 |
1.1 2.2 3.3 |
|
747 |
1.1 |
|
748 |
1.1 |
|
752 |
1.1 |
|
754 |
1.1 |
|
755 |
1.1 |
|
756 |
1.1 |
|
758 |
1.1 |
|
759 |
1.1 |
|
760 |
1.1 |
|
762 |
1.1 2.2 |
|
784 |
1.1 2.2 3.3 |
|
788 |
1.1 |
|
791 |
1.1 |
|
804 |
1.1 |
|
806 |
1.1 |
|
807 |
1.1 |
|
809 |
1.1 |
|
813 |
1.1 |
|
817 |
1.1 2.2 |
|
822 |
1.1 |
|
827 |
1.1 2.2 |
|
830 |
1.1 2.2 3.3 |
|
834 |
1.1 |
|
838 |
1.1 2.2 3.3 4.4 5.5 |
|
841 |
1.1 |
|
843 |
1.1 2.2 |
|
845 |
1.1 |
|
846 |
1.1 |
|
849 |
1.1 2.2 |
|
851 |
1.1 |
|
853 |
1.1 |
|
855 |
1.1 |
|
857 |
1.1 |
|
864 |
1.1 |
|
867 |
1.1 |
|
868 |
1.1 |
|
869 |
1.1 |
|
872 |
1.1 |
|
876 |
1.1 |
|
878 |
1.1 2.2 3.3 |
|
880 |
1.1 |
|
883 |
1.1 |
|
885 |
1.1 |
|
886 |
1.1 |
|
892 |
1.1 |
|
893 |
1.1 2.2 |
|
895 |
1.1 2.2 |
|
897 |
1.1 |
|
904 |
1.1 2.2 |
|
906 |
1.1 2.2 |
|
908 |
1.1 |
|
911 |
1.1 |
|
917 |
1.1 |
|
919 |
1.1 |
|
923 |
1.1 2.2 |
|
924 |
1.1 2.2 3.3 |
|
927 |
1.1 |
|
929 |
1.1 2.2 |
|
931 |
1.1 2.2 |
|
933 |
1.1 2.2 |
|
935 |
1.1 |
|
938 |
1.1 |
|
940 |
1.1 |
|
943 |
1.1 |
|
949 |
1.1 |
|
952 |
1.1 |
|
953 |
1.1 |
|
955 |
1.1 |
|
957 |
1.1 |
|
958 |
1.1 |
|
960 |
1.1 |
|
962 |
1.1 |
|
969 |
1.1 2.2 |
|
973 |
1.1 |
|
975 |
1.1 2.2 |
|
976 |
1.1 |
|
982 |
1.1 |
|
985 |
1.1 2.2 3.3 |
|
989 |
1.1 |
|
991 |
1.1 2.2 3.3 |
|
994 |
1.1 2.2 |
|
998 |
1.1 |
|
1001 |
1.1 |
|
1003 |
1.1 2.2 3.3 4.4 |
|
1006 |
1.1 |
|
1008 |
1.1 |
|
1014 |
1.1 2.2 |
|
1016 |
1.1 |
|
1018 |
1.1 |
|
1023 |
1.1 |
|
1026 |
1.1 |
|
1029 |
1.1 |
|
1032 |
1.1 |
|
1035 |
1.1 |
|
1041 |
1.1 |
|
1045 |
1.1 |
|
1046 |
1.1 |
|
1047 |
1.1 |
|
1051 |
1.1 2.2 |
|
1054 |
1.1 |
|
1056 |
1.1 |
|
1059 |
1.1 |
|
1063 |
1.1 |
|
1066 |
1.1 |
|
1076 |
1.1 |
|
1078 |
1.1 |
|
1091 |
1.1 |
|
1093 |
1.1 |
|
1094 |
1.1 |
|
1097 |
1.1 |
|
1099 |
1.1 |
|
1100 |
1.1 |
|
1102 |
1.1 |
|
1103 |
1.1 |
|
1104 |
1.1 |
|
1107 |
1.1 |
|
1111 |
1.1 |
|
1115 |
1.1 |
|
1117 |
1.1 |
|
1118 |
1.1 |
|
1121 |
1.1 |
|
1123 |
1.1 |
|
1124 |
1.1 |
|
1126 |
1.1 |
|
1128 |
1.1 |
|
1132 |
1.1 |
|
1134 |
1.1 |
|
1136 |
1.1 |
|
1138 |
1.1 |
|
1139 |
1.1 |
|
1140 |
1.1 |
|
1141 |
1.1 |
|
1142 |
1.1 |
|
1144 |
1.1 |
|
1146 |
1.1 |
|
1147 |
1.1 |
|
1148 |
1.1 |
|
1149 |
1.1 |
|
1151 |
1.1 |
|
1152 |
1.1 |
|
1153 |
1.1 |
|
1160 |
1.1 |
|
1162 |
1.1 |
|
1170 |
1.1 |
|
1174 |
1.1 |
|
1176 |
1.1 |
|
1182 |
1.1 2.2 |
|
1184 |
1.1 |
|
1185 |
1.1 |
|
1187 |
1.1 |
|
1188 |
1.1 |
|
1191 |
1.1 |
|
1192 |
1.1 |
|
1194 |
1.1 |
|
1197 |
1.1 2.2 |
|
1199 |
1.1 |
|
1200 |
1.1 |
|
1204 |
1.1 |
|
1205 |
1.1 |
|
1207 |
1.1 2.2 3.3 4.4 5.5 |
|
1212 |
1.1 |
|
1213 |
1.1 |
|
1215 |
1.1 |
|
1219 |
1.1 |
|
1220 |
1.1 |
|
1221 |
1.1 |
|
1222 |
1.1 |
|
1223 |
1.1 |
|
1226 |
1.1 |
|
1228 |
1.1 |
|
1230 |
1.1 |
|
1236 |
1.1 |
|
1237 |
1.1 |
|
1248 |
1.1 |
|
1249 |
1.1 |
|
1253 |
1.1 |
|
1256 |
1.1 |
|
1257 |
1.1 |
|
1269 |
1.1 |
|
1271 |
1.1 |
|
1273 |
1.1 |
|
1274 |
1.1 |
|
1279 |
1.1 |
|
1283 |
1.1 |
|
1285 |
1.1 |
|
1286 |
1.1 |
|
1288 |
1.1 |
|
1290 |
1.1 |
|
1295 |
1.1 |
|
1299 |
1.1 |
|
1301 |
1.1 |
|
1302 |
1.1 |
|
1304 |
1.1 |
|
1311 |
1.1 |
|
1312 |
1.1 |
|
1320 |
1.1 |
|
1325 |
1.1 |
|
1334 |
1.1 |
|
1338 |
1.1 |
|
1340 |
1.1 |
|
1341 |
1.1 |
|
1344 |
1.1 |
|
1345 |
1.1 |
|
1346 |
1.1 |
|
1356 |
1.1 |
|
1366 |
1.1 |
|
1374 |
1.1 |
|
1396 |
1.1 2.2 |
|
1400 |
1.1 |
|
1402 |
1.1 |
|
1403 |
1.1 |
|
1405 |
1.1 |
|
1406 |
1.1 |
|
1432 |
1.1 2.2 |
|
1433 |
1.1 |
|
1435 |
1.1 |
|
1436 |
1.1 |
|
1446 |
1.1 |
|
1447 |
1.1 |
|
1449 |
1.1 |
|
1450 |
1.1 |
|
1454 |
1.1 2.2 |
|
1456 |
1.1 |
|
1460 |
1.1 |
|
1466 |
1.1 |
|
1489 |
1.1 |
|
1490 |
1.1 |
|
1491 |
1.1 |
|
1492 |
1.1 |
|
1493 |
1.1 |
|
1497 |
1.1 |
|
1498 |
1.1 |
|
1501 |
1.1 |
|
1503 |
1.1 |
|
1504 |
1.1 |
|
1505 |
1.1 |
|
1507 |
1.1 |
|
1533 |
1.1 |
|
1535 |
1.1 |
|
1536 |
1.1 |
|
1554 |
1.1 |
|
1558 |
1.1 |
|
1565 |
1.1 |
|
1568 |
1.1 |
|
1569 |
1.1 |
|
1570 |
1.1 |
|
1575 |
1.1 |
|
1576 |
1.1 |
|
1579 |
1.1 |
|
1583 |
1.1 |
|
1584 |
1.1 |
|
1589 |
1.1 |
|
1603 |
1.1 2.2 |
|
1605 |
1.1 |
|
1607 |
1.1 |
|
1608 |
1.1 |
|
1609 |
1.1 |
|
1610 |
1.1 |
|
1612 |
1.1 2.2 3.3 4.4 5.5 |
|
1613 |
1.1 |
|
1614 |
1.1 |
|
1617 |
1.1 |
|
1619 |
1.1 |
|
1621 |
1.1 |
|
1623 |
1.1 |
|
1624 |
1.1 |
|
1625 |
1.1 |
|
1626 |
1.1 |
|
1629 |
1.1 |
|
1632 |
1.1 |
|
1635 |
1.1 |
|
1648 |
1.1 |
|
1649 |
1.1 |
|
1656 |
1.1 |
|
1661 |
1.1 |
|
1664 |
1.1 |
|
1665 |
1.1 |
|
1672 |
1.1 |
|
1687 |
1.1 |