Skip to content

Commit 3cc23ad

Browse files
yulian-gaponenkoiText-CI
authored andcommitted
Remove debugMode option from WriterProperties
It was related to pdfDebug only. DEVSIX-5706
1 parent b698c88 commit 3cc23ad

File tree

3 files changed

+1
-94
lines changed

3 files changed

+1
-94
lines changed

commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<version>7.2.0-SNAPSHOT</version>
88
</parent>
99
<artifactId>commons</artifactId>
10-
<name>iText 7 - events</name>
10+
<name>iText 7 - commons</name>
1111
<url>https://itextpdf.com/</url>
1212

1313
<dependencies>

kernel/src/main/java/com/itextpdf/kernel/pdf/PdfWriter.java

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public class PdfWriter extends PdfOutputStream {
6464
private static final byte[] obj = ByteUtils.getIsoBytes(" obj\n");
6565
private static final byte[] endobj = ByteUtils.getIsoBytes("\nendobj\n");
6666

67-
// For internal usage only
68-
private PdfOutputStream duplicateStream = null;
69-
7067
protected WriterProperties properties;
7168

7269
/**
@@ -114,9 +111,6 @@ public PdfWriter(java.io.OutputStream os) {
114111
public PdfWriter(java.io.OutputStream os, WriterProperties properties) {
115112
super(new CountOutputStream(FileUtil.wrapWithBufferedOutputStream(os)));
116113
this.properties = properties;
117-
if (properties.debugMode) {
118-
duplicateStream = new PdfOutputStream(new ByteArrayOutputStream());
119-
}
120114
}
121115

122116
/**
@@ -192,80 +186,6 @@ public PdfWriter setSmartMode(boolean smartMode) {
192186
return this;
193187
}
194188

195-
/**
196-
* Write an integer to the underlying stream
197-
*
198-
* @param b integer to write
199-
* @throws java.io.IOException if an I/O error occurs. In particular,
200-
* an <code>IOException</code> may be thrown if the output stream
201-
* has been closed.
202-
*/
203-
@Override
204-
public void write(int b) throws java.io.IOException {
205-
super.write(b);
206-
if (duplicateStream != null) {
207-
duplicateStream.write(b);
208-
}
209-
}
210-
211-
/**
212-
* Write a byte array to the underlying stream
213-
*
214-
* @param b byte array to write
215-
* @throws java.io.IOException if an I/O error occurs. In particular,
216-
* an <code>IOException</code> may be thrown if the output stream
217-
* has been closed.
218-
*/
219-
@Override
220-
public void write(byte[] b) throws java.io.IOException {
221-
super.write(b);
222-
if (duplicateStream != null) {
223-
duplicateStream.write(b);
224-
}
225-
}
226-
227-
/**
228-
* Write a slice of the passed byte array to the underlying stream
229-
*
230-
* @param b byte array to slice and write.
231-
* @param off starting index of the slice.
232-
* @param len length of the slice.
233-
* @throws java.io.IOException if an I/O error occurs. In particular,
234-
* an <code>IOException</code> may be thrown if the output stream
235-
* has been closed.
236-
*/
237-
@Override
238-
public void write(byte[] b, int off, int len) throws java.io.IOException {
239-
super.write(b, off, len);
240-
if (duplicateStream != null) {
241-
duplicateStream.write(b, off, len);
242-
}
243-
}
244-
245-
246-
/**
247-
* Close the writer and underlying streams.
248-
*
249-
* @throws java.io.IOException if an I/O error occurs. In particular,
250-
* an <code>IOException</code> may be thrown if the output stream
251-
* has been closed previously.
252-
*/
253-
@Override
254-
public void close() throws IOException {
255-
try {
256-
super.close();
257-
} finally {
258-
try {
259-
if (duplicateStream != null) {
260-
duplicateStream.close();
261-
}
262-
} catch (Exception ex) {
263-
Logger logger = LoggerFactory.getLogger(PdfWriter.class);
264-
logger.error("Closing of the duplicatedStream failed.", ex);
265-
}
266-
}
267-
}
268-
269189
/**
270190
* Gets the current object stream.
271191
*

kernel/src/main/java/com/itextpdf/kernel/pdf/WriterProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class WriterProperties {
6060
* and reused if there's an object with the same content later.
6161
*/
6262
protected boolean smartMode;
63-
protected boolean debugMode;
6463
protected boolean addXmpMetadata;
6564
protected boolean addUAXmpMetadata;
6665
protected PdfVersion pdfVersion;
@@ -77,7 +76,6 @@ public class WriterProperties {
7776

7877
public WriterProperties() {
7978
smartMode = false;
80-
debugMode = false;
8179
addUAXmpMetadata = false;
8280
compressionLevel = CompressionConstants.DEFAULT_COMPRESSION;
8381
isFullCompression = null;
@@ -250,17 +248,6 @@ public WriterProperties setModifiedDocumentId(PdfString modifiedDocumentId) {
250248
this.modifiedDocumentId = modifiedDocumentId;
251249
return this;
252250
}
253-
/**
254-
* This activates debug mode with pdfDebug tool.
255-
* It causes additional overhead of duplicating document bytes into memory, so use it careful.
256-
* NEVER use it in production or in any other cases except pdfDebug.
257-
*
258-
* @return this {@link WriterProperties} instance
259-
*/
260-
public WriterProperties useDebugMode() {
261-
this.debugMode = true;
262-
return this;
263-
}
264251

265252
/**
266253
* This method marks the document as PDF/UA and sets related flags is XMPMetaData.

0 commit comments

Comments
 (0)