- 4.0.0
+
+ 4.0.0
-
- com.github.librepdf
- openpdf-parent
- 1.3.43.jaspersoft.2
-
+
+ com.github.librepdf
+ openpdf-parent
+ 1.4.2.jaspersoft.1-SNAPSHOT
+
- openpdf
+ openpdf
-
- com.github.librepdf.openpdf
-
+
+ com.github.librepdf.openpdf
+
-
-
- com.ibm.icu
- icu4j
- 74.2
- true
-
-
- org.bouncycastle
- bcprov-jdk18on
- true
-
-
- org.bouncycastle
- bcpkix-jdk18on
- true
-
-
- org.apache.xmlgraphics
- fop
- true
-
+
+
+ com.ibm.icu
+ icu4j
+ 74.2
+ true
+
+
+ org.bouncycastle
+ bcprov-jdk18on
+ true
+
+
+ org.bouncycastle
+ bcpkix-jdk18on
+ true
+
+
+ org.apache.xmlgraphics
+ fop
+ true
+
-
-
- org.junit.jupiter
- junit-jupiter-api
- test
-
-
- org.junit.jupiter
- junit-jupiter-params
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
-
- org.hamcrest
- hamcrest
- test
-
-
- commons-io
- commons-io
- test
-
-
- org.verapdf
- validation-model
- 1.24.1
- true
- test
-
-
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+ org.assertj
+ assertj-core
+ test
+
+
+ org.mockito
+ mockito-core
+ 5.10.0
+ test
+
+
+ org.hamcrest
+ hamcrest
+ test
+
+
+ commons-io
+ commons-io
+ test
+
+
+ org.verapdf
+ validation-model
+ 1.24.1
+ true
+ test
+
+
-
-
-
- src/main/resources
-
-
- src/main/resources-filtered
- true
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- true
-
-
-
-
+
+
+
+ src/main/resources
+
+
+ src/main/resources-filtered
+ true
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+
+
+ true
+
+
+
+
diff --git a/openpdf/src/main/java/com/lowagie/text/Annotation.java b/openpdf/src/main/java/com/lowagie/text/Annotation.java
index 65fb5c414..b04c7a16c 100644
--- a/openpdf/src/main/java/com/lowagie/text/Annotation.java
+++ b/openpdf/src/main/java/com/lowagie/text/Annotation.java
@@ -578,17 +578,6 @@ public String content() {
return s;
}
- /**
- * Gets the content of this Annotation.
- *
- * @return a reference
- * @deprecated use {@link #getAttributes()}
- */
- @Deprecated
- public HashMap attributes() {
- return (HashMap) annotationAttributes;
- }
-
/**
* Gets the content of this Annotation.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/Cell.java b/openpdf/src/main/java/com/lowagie/text/Cell.java
index 68f9f8b42..5e5f2171b 100644
--- a/openpdf/src/main/java/com/lowagie/text/Cell.java
+++ b/openpdf/src/main/java/com/lowagie/text/Cell.java
@@ -277,30 +277,6 @@ public int getHorizontalAlignment() {
return horizontalAlignment;
}
- /**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Cell#setHorizontalAlignment(HorizontalAlignment)} instead
- */
- @Deprecated
- public void setHorizontalAlignment(int value) {
- horizontalAlignment = value;
- }
-
- /**
- * Sets the alignment of this cell. This methods allows you to set the alignment as a String.
- *
- * @param alignment the new alignment as a String
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Cell#setHorizontalAlignment(HorizontalAlignment)} instead
- */
- @Deprecated
- public void setHorizontalAlignment(String alignment) {
- setHorizontalAlignment(ElementTags.alignmentValue(alignment));
- }
-
@Override
public void setHorizontalAlignment(final HorizontalAlignment alignment) {
if (alignment == null) {
@@ -319,30 +295,6 @@ public int getVerticalAlignment() {
return verticalAlignment;
}
- /**
- * Sets the vertical alignment.
- *
- * @param value the new value
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Cell#setVerticalAlignment(VerticalAlignment)} instead
- */
- @Deprecated
- public void setVerticalAlignment(int value) {
- verticalAlignment = value;
- }
-
- /**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment as a String
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Cell#setVerticalAlignment(VerticalAlignment)} instead
- */
- @Deprecated
- public void setVerticalAlignment(String alignment) {
- setVerticalAlignment(ElementTags.alignmentValue(alignment));
- }
-
@Override
public void setVerticalAlignment(final VerticalAlignment alignment) {
if (alignment == null) {
diff --git a/openpdf/src/main/java/com/lowagie/text/Chunk.java b/openpdf/src/main/java/com/lowagie/text/Chunk.java
index 15e1572d6..e217b5f9a 100644
--- a/openpdf/src/main/java/com/lowagie/text/Chunk.java
+++ b/openpdf/src/main/java/com/lowagie/text/Chunk.java
@@ -298,6 +298,8 @@ public Chunk(Image image, float offsetX, float offsetY) {
offsetY, Boolean.FALSE});
}
+ // the attributes are ordered as they appear in the book 'iText in Action'
+
/**
* Creates a separator Chunk. Note that separator chunks can't be used in combination with tab chunks!
*
@@ -320,8 +322,6 @@ public Chunk(DrawInterface separator, boolean vertical) {
setAttribute(SEPARATOR, new Object[]{separator, vertical});
}
- // the attributes are ordered as they appear in the book 'iText in Action'
-
/**
* Creates a tab Chunk. Note that separator chunks can't be used in combination with tab chunks!
*
@@ -482,31 +482,6 @@ public boolean hasAttributes() {
return attributes != null;
}
- /**
- * Gets the attributes for this Chunk.
- *
- * It may be null.
- *
- * @return the attributes for this Chunk
- * @deprecated use {@link #getChunkAttributes()}
- */
- @Deprecated
- public HashMap getAttributes() {
- return (HashMap) attributes;
- }
-
- /**
- * Sets the attributes all at once.
- *
- * @param attributes the attributes of a Chunk
- * @deprecated use {@link #setChunkAttributes(Map)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setAttributes(HashMap attributes) {
- this.attributes = attributes;
- }
-
/**
* Gets the attributes for this Chunk.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/ImageLoader.java b/openpdf/src/main/java/com/lowagie/text/ImageLoader.java
index 096d6d21e..fd959c275 100644
--- a/openpdf/src/main/java/com/lowagie/text/ImageLoader.java
+++ b/openpdf/src/main/java/com/lowagie/text/ImageLoader.java
@@ -161,11 +161,7 @@ public static Image getBmpImage(byte[] imageData) {
}
/**
- * Creates an Image from an array of tiff image bytes. For JRE < 9, `ImageIO.read()` requires a supporting library
- * in the classpath to read tiffs. Options are: - https://github.com/jai-imageio/jai-imageio-core -
- * https://github.com/haraldk/TwelveMonkeys
- *
- * see: https://openjdk.java.net/jeps/262
+ * Creates an Image from an array of tiff image bytes.
*
* @param imageData bytes of the tiff image
* @return an objet of type Image
diff --git a/openpdf/src/main/java/com/lowagie/text/Paragraph.java b/openpdf/src/main/java/com/lowagie/text/Paragraph.java
index d0f800c20..d190f6f5b 100644
--- a/openpdf/src/main/java/com/lowagie/text/Paragraph.java
+++ b/openpdf/src/main/java/com/lowagie/text/Paragraph.java
@@ -494,30 +494,6 @@ public void setExtraParagraphSpace(float extraParagraphSpace) {
this.extraParagraphSpace = extraParagraphSpace;
}
- // scheduled for removal
-
- /**
- * Gets the spacing before this paragraph.
- *
- * @return the spacing
- * @deprecated As of iText 2.1.5, replaced by {@link #getSpacingBefore()}, scheduled for removal at 2.3.0
- */
- @Deprecated
- public float spacingBefore() {
- return getSpacingBefore();
- }
-
- /**
- * Gets the spacing after this paragraph.
- *
- * @return the spacing
- * @deprecated As of iText 2.1.5, replaced by {@link #getSpacingAfter()}, scheduled for removal at 2.3.0
- */
- @Deprecated
- public float spacingAfter() {
- return spacingAfter;
- }
-
public int getRunDirection() {
return runDirection;
}
diff --git a/openpdf/src/main/java/com/lowagie/text/Row.java b/openpdf/src/main/java/com/lowagie/text/Row.java
index 8037b67f1..8549ed3d4 100644
--- a/openpdf/src/main/java/com/lowagie/text/Row.java
+++ b/openpdf/src/main/java/com/lowagie/text/Row.java
@@ -410,18 +410,6 @@ public int getHorizontalAlignment() {
return horizontalAlignment;
}
- /**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Row#setHorizontalAlignment(HorizontalAlignment)} instead
- */
- @Deprecated
- public void setHorizontalAlignment(int value) {
- horizontalAlignment = value;
- }
-
@Override
public void setHorizontalAlignment(final HorizontalAlignment alignment) {
if (alignment == null) {
diff --git a/openpdf/src/main/java/com/lowagie/text/StandardFonts.java b/openpdf/src/main/java/com/lowagie/text/StandardFonts.java
index 7e914be5d..933880c4f 100644
--- a/openpdf/src/main/java/com/lowagie/text/StandardFonts.java
+++ b/openpdf/src/main/java/com/lowagie/text/StandardFonts.java
@@ -13,6 +13,7 @@ public enum StandardFonts {
HELVETICA_ITALIC(Font.HELVETICA, Font.ITALIC),
HELVETICA_BOLD(Font.HELVETICA, Font.BOLD),
HELVETICA_BOLDITALIC(Font.HELVETICA, Font.BOLDITALIC),
+
// Times
TIMES(Font.TIMES_ROMAN, Font.NORMAL),
TIMES_ITALIC(Font.TIMES_ROMAN, Font.ITALIC),
@@ -25,36 +26,19 @@ public enum StandardFonts {
private int family;
private int style;
- /**
- * @deprecated Use Liberation
- */
- @Deprecated
- private String trueTypeFile;
StandardFonts(int family, int style) {
this.family = family;
this.style = style;
}
- /**
- * @deprecated Use Liberation
- */
- @Deprecated
- StandardFonts(String trueTypeFile) {
- this.trueTypeFile = trueTypeFile;
- }
-
public Font create() throws IOException {
return create(Font.DEFAULTSIZE);
}
public Font create(int size) throws IOException {
final Font font;
- if (trueTypeFile != null) {
- final String message = String
- .format("%s: Please use fonts from openpdf-fonts-extra (Liberation)", this);
- throw new IOException(message);
- } else if (style == -1) {
+ if (style == -1) {
font = new Font(family, size);
} else {
font = new Font(family, size, style);
@@ -63,6 +47,6 @@ public Font create(int size) throws IOException {
}
public boolean isDeprecated() {
- return trueTypeFile != null;
+ return false;
}
}
diff --git a/openpdf/src/main/java/com/lowagie/text/Table.java b/openpdf/src/main/java/com/lowagie/text/Table.java
index 3b7ddbb46..8ee72d907 100644
--- a/openpdf/src/main/java/com/lowagie/text/Table.java
+++ b/openpdf/src/main/java/com/lowagie/text/Table.java
@@ -437,38 +437,6 @@ public int getAlignment() {
return alignment;
}
- /**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Table#setHorizontalAlignment(HorizontalAlignment)} instead
- */
- @Deprecated
- public void setAlignment(int value) {
- alignment = value;
- }
-
- /**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment as a String
- * @deprecated Setting alignment through unconstrained types is non-obvious and error-prone, use
- * {@link Table#setHorizontalAlignment(HorizontalAlignment)} instead
- */
- @Deprecated
- public void setAlignment(String alignment) {
- if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_LEFT;
- return;
- }
- if (ElementTags.RIGHT.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_RIGHT;
- return;
- }
- this.alignment = Element.ALIGN_CENTER;
- }
-
@Override
public void setHorizontalAlignment(final HorizontalAlignment alignment) {
if (alignment == null) {
@@ -1535,25 +1503,4 @@ public void setComplete(boolean complete) {
this.complete = complete;
}
- /**
- * Gets the default layout of the Table.
- *
- * @return a cell with all the defaults
- * @deprecated As of iText 2.0.7, replaced by {@link #getDefaultCell()}, scheduled for removal at 2.2.0
- */
- @Deprecated
- public Cell getDefaultLayout() {
- return getDefaultCell();
- }
-
- /**
- * Sets the default layout of the Table to the provided Cell
- *
- * @param value a cell with all the defaults
- * @deprecated As of iText 2.0.7, replaced by {@link #setDefaultCell(Cell)}, scheduled for removal at 2.2.0
- */
- @Deprecated
- public void setDefaultLayout(Cell value) {
- defaultCell = value;
- }
}
diff --git a/openpdf/src/main/java/com/lowagie/text/html/FontSize.java b/openpdf/src/main/java/com/lowagie/text/html/FontSize.java
index b783d014a..d905d9587 100644
--- a/openpdf/src/main/java/com/lowagie/text/html/FontSize.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/FontSize.java
@@ -32,7 +32,7 @@ public enum FontSize {
}
public static FontSize parse(String text) {
- if (text == null || text.length() == 0 || !Character.isLetter(text.charAt(0))) {
+ if (text == null || text.isEmpty() || !Character.isLetter(text.charAt(0))) {
return null;
}
for (FontSize fontSize : values()) {
diff --git a/openpdf/src/main/java/com/lowagie/text/html/Markup.java b/openpdf/src/main/java/com/lowagie/text/html/Markup.java
index f14dd1f7b..a101fd332 100644
--- a/openpdf/src/main/java/com/lowagie/text/html/Markup.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/Markup.java
@@ -492,6 +492,7 @@ public static float parseLength(String string, float actualFontSize) {
return fs.getScale() * DEFAULT_FONT_SIZE;
}
}
+
int pos = 0;
int length = string.length();
boolean ok = true;
diff --git a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/ChainedProperties.java b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/ChainedProperties.java
index 451d8c42f..20067ac29 100755
--- a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/ChainedProperties.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/ChainedProperties.java
@@ -63,8 +63,7 @@ public class ChainedProperties {
/**
* Will be replaced with types alternative
*/
- @Deprecated
- public ArrayList chain = new ArrayList<>();
+ public ArrayList chain = new ArrayList<>();
/**
* Creates a new instance of ChainedProperties
@@ -85,7 +84,7 @@ public String getProperty(String key) {
*/
public Optional findProperty(String key) {
for (int k = chain.size() - 1; k >= 0; --k) {
- Object[] obj = (Object[]) chain.get(k);
+ Object[] obj = chain.get(k);
HashMap prop = (HashMap) obj[1];
String ret = (String) prop.get(key);
if (ret != null) {
@@ -117,17 +116,6 @@ public boolean hasProperty(String key) {
return false;
}
- /**
- * @param key the key
- * @param prop the properties
- * @deprecated use {@link ChainedProperties#addToChain(String, HashMap)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void addToChain(String key, HashMap prop) {
- addToChain(key, (Map) prop);
- }
-
public void addToChain(String key, Map prop) {
// adjust the font size
String value = prop.get(ElementTags.SIZE);
diff --git a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java
index d2ad98795..4c4c89ce4 100755
--- a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java
@@ -223,17 +223,10 @@ public static HyphenationEvent getHyphenation(String s) {
* This method isn't used by iText, but you can use it to analyze the value of a style attribute inside a HashMap.
* The different elements of the style attribute are added to the HashMap as key-value pairs.
*
- * @param h a HashMap that should have at least a key named style. After this method is invoked, more keys could be
+ * @param h a Map that should have at least a key named style. After this method is invoked, more keys could be
* added.
- * @deprecated use {@link FactoryProperties#insertStyle(Map)} instead. (since 1.2.22)
*/
- @SuppressWarnings("unchecked")
- @Deprecated
// this method is nor called anywhere. But it is public so theoretically it could be called by consumers of OpenPdf, but why?
- public static void insertStyle(HashMap h) {
- insertStyle((Map) h);
- }
-
public static void insertStyle(Map h) {
String style = h.get("style");
if (style == null) {
diff --git a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/HTMLWorker.java b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/HTMLWorker.java
index 8fac7c150..51bdf6c9f 100755
--- a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/HTMLWorker.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/HTMLWorker.java
@@ -128,21 +128,6 @@ public static ArrayList parseToList(Reader reader, StyleSheet style) th
return parseToList(reader, style, interfaceProps);
}
- /**
- * @param reader the Reader
- * @param style the StyleSheet
- * @param interfaceProps the interface properties
- * @return an ArrayList
- * @throws IOException on error
- * @deprecated use {@link HTMLWorker#parseToList(Reader, StyleSheet, Map)} since 1.2.22
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public static ArrayList parseToList(Reader reader, StyleSheet style, HashMap interfaceProps)
- throws IOException {
- return parseToList(reader, style, (Map) interfaceProps);
- }
-
public static ArrayList parseToList(Reader reader, StyleSheet style, Map interfaceProps)
throws IOException {
HTMLWorker worker = new HTMLWorker(null);
@@ -168,16 +153,6 @@ public Map getInterfaceProps() {
return interfaceProps;
}
- /**
- * @param interfaceProps the properties of the interface
- * @deprecated use {@link HTMLWorker#setInterfaceProps(Map)} since 1.2.22
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public void setInterfaceProps(HashMap interfaceProps) {
- setInterfaceProps((Map) interfaceProps);
- }
-
public void setInterfaceProps(Map interfaceProps) {
this.interfaceProps = interfaceProps;
FontProvider ff = null;
@@ -211,15 +186,6 @@ public void startDocument() {
cprops.addToChain("body", h);
}
- /**
- * @deprecated use {@link HTMLWorker#startElement(String, Map)} } since 1.2.22
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void startElement(String tag, HashMap h) {
- startElement(tag, (Map) h);
- }
-
public void startElement(String tag, Map style) {
if (!tagsSupported.containsKey(tag)) {
return;
diff --git a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/IncTable.java b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/IncTable.java
index 5bfd03e6a..11e0568ea 100755
--- a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/IncTable.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/IncTable.java
@@ -64,18 +64,6 @@ public class IncTable {
private List> rows = new ArrayList<>();
private List cols;
- /**
- * Creates a new instance of IncTable
- *
- * @param props a HashMap of the properties
- */
-
- @Deprecated
- @SuppressWarnings("unchecked")
- public IncTable(HashMap props) {
- this.props.putAll(props);
- }
-
public IncTable(Map props) {
this.props.putAll(props);
}
@@ -87,16 +75,6 @@ public void addCol(PdfPCell cell) {
cols.add(cell);
}
- @Deprecated
- @SuppressWarnings("unchecked")
- public void addCols(ArrayList ncols) {
- if (cols == null) {
- cols = (List) ncols;
- } else {
- cols.addAll(ncols);
- }
- }
-
public void addCols(List ncols) {
if (cols == null) {
cols = new ArrayList<>(ncols);
@@ -113,15 +91,6 @@ public void endRow() {
}
}
- /**
- * @return an ArrayList of the Rows
- * @deprecated use {@link #getTableRows()}
- */
- @Deprecated
- public ArrayList getRows() {
- return (ArrayList) rows;
- }
-
public List> getTableRows() {
return rows;
}
diff --git a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/StyleSheet.java b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/StyleSheet.java
index bd48c6038..09e8b5d77 100755
--- a/openpdf/src/main/java/com/lowagie/text/html/simpleparser/StyleSheet.java
+++ b/openpdf/src/main/java/com/lowagie/text/html/simpleparser/StyleSheet.java
@@ -59,18 +59,6 @@ public class StyleSheet {
private final Map> classMap = new HashMap<>();
private final Map> tagMap = new HashMap<>();
- /**
- * @param props a HashMap
- * @param tag the tag
- * @deprecated please use #applyStyle(String tag, Map<String, String> props) this method will be removed in
- * 2.0
- */
- @Deprecated
- @SuppressWarnings({"unchecked", "rawtypes"})
- public void applyStyle(String tag, HashMap props) {
- applyStyle(tag, (Map) props);
- }
-
public void applyStyle(String tag, Map props) {
Map map = tagMap.get(tag.toLowerCase());
if (map != null) {
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java b/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java
index 6697aa52c..9503cf089 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java
@@ -707,7 +707,7 @@ public boolean renameField(String oldName, String newName) {
}
public void decodeGenericDictionary(PdfDictionary merged, BaseField tx) throws DocumentException {
- int flags;
+ int flags = 0;
// the text size and color
PdfString da = merged.getAsString(PdfName.DA);
if (da != null) {
@@ -897,9 +897,8 @@ PdfAppearance getAppearance(PdfDictionary merged, String[] values, String fieldN
return tx.getAppearance();
}
if (!PdfName.CH.equals(fieldType)) {
- throw new DocumentException(
- MessageLocalization.getComposedMessage(
- "an.appearance.was.requested.without.a.variable.text.field"));
+ throw new DocumentException(MessageLocalization.getComposedMessage(
+ "an.appearance.was.requested.without.a.variable.text.field"));
}
PdfArray opt = merged.getAsArray(PdfName.OPT);
int flags = 0;
@@ -1240,7 +1239,7 @@ public boolean setFieldProperty(String field, String name, Object value, int[] i
PdfAppearance cb = new PdfAppearance(this.writer);
if (dao[DA_FONT] != null) {
ByteBuffer buf = cb.getInternalBuffer();
- float fontSize = (float) Font.DEFAULTSIZE;
+ Float fontSize = (float) Font.DEFAULTSIZE;
if (value != null) {
fontSize = (Float) value;
}
@@ -1588,6 +1587,55 @@ public void mergeXfaData(Node n) throws IOException, DocumentException {
}
}
+ /**
+ * Sets the fields by FDF merging.
+ *
+ * @param fdf the FDF form
+ * @throws IOException on error
+ * @throws DocumentException on error
+ */
+ public void setFields(FdfReader fdf) throws IOException, DocumentException {
+ Map fd = fdf.getAllFields();
+ for (String f : fd.keySet()) {
+ String v = fdf.getFieldValue(f);
+ if (v != null) {
+ setField(f, v);
+ }
+ }
+ }
+
+ /**
+ * Allows merging the fields by a field reader. One use would be to set the fields by XFDF merging.
+ *
+ * @param fieldReader The fields to merge.
+ * @throws IOException on error
+ * @throws DocumentException on error
+ */
+ public void setFields(XfdfReader fieldReader) throws IOException, DocumentException {
+ setFields((FieldReader) fieldReader);
+ }
+
+ /**
+ * Allows merging the fields by a field reader. One use would be to set the fields by XFDF merging.
+ *
+ * @param fieldReader The fields to merge.
+ * @throws IOException on error
+ * @throws DocumentException on error
+ */
+ public void setFields(FieldReader fieldReader) throws IOException, DocumentException {
+ Map fd = fieldReader.getAllFields();
+ for (String f : fd.keySet()) {
+ String v = fieldReader.getFieldValue(f);
+ if (v != null) {
+ setField(f, v);
+ }
+ List list = fieldReader.getListValues(f);
+ if (list != null) {
+ setListSelection(v, list.toArray(new String[0]));
+ }
+ }
+ }
+
/**
* Regenerates the field appearance. This is useful when you change a field property, but not its value, for
* instance form.setFieldProperty("f", "bgcolor", Color.BLUE, null); This won't have any effect, unless you use
@@ -1820,67 +1868,6 @@ boolean isInAP(PdfDictionary dic, PdfName check) {
return (NDic != null && NDic.get(check) != null);
}
- /**
- * Gets all the fields. The fields are keyed by the fully qualified field name and the value is an instance of
- * AcroFields.Item.
- *
- * @return all the fields
- * @deprecated use {@link AcroFields#getAllFields()}
- */
- @Deprecated
- public HashMap getFields() {
- return (HashMap) fields;
- }
-
- /**
- * Sets the fields by FDF merging.
- *
- * @param fdf the FDF form
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public void setFields(FdfReader fdf) throws IOException, DocumentException {
- Map fd = fdf.getAllFields();
- for (String f : fd.keySet()) {
- String v = fdf.getFieldValue(f);
- if (v != null) {
- setField(f, v);
- }
- }
- }
-
- /**
- * Allows merging the fields by a field reader. One use would be to set the fields by XFDF merging.
- *
- * @param fieldReader The fields to merge.
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public void setFields(XfdfReader fieldReader) throws IOException, DocumentException {
- setFields((FieldReader) fieldReader);
- }
-
- /**
- * Allows merging the fields by a field reader. One use would be to set the fields by XFDF merging.
- *
- * @param fieldReader The fields to merge.
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public void setFields(FieldReader fieldReader) throws IOException, DocumentException {
- Map fd = fieldReader.getAllFields();
- for (String f : fd.keySet()) {
- String v = fieldReader.getFieldValue(f);
- if (v != null) {
- setField(f, v);
- }
- List list = fieldReader.getListValues(f);
- if (list != null) {
- setListSelection(v, list.toArray(new String[0]));
- }
- }
- }
-
/**
* Gets all the fields. The fields are keyed by the fully qualified field name and the value is an instance of
* AcroFields.Item.
@@ -2132,17 +2119,6 @@ public void setGenerateAppearances(boolean generateAppearances) {
}
}
- /**
- * Gets the field names that have signatures and are signed.
- *
- * @return the field names that have signatures and are signed
- * @deprecated user {@link AcroFields#getSignedFieldNames()}
- */
- @Deprecated
- public ArrayList getSignatureNames() {
- return (ArrayList) getSignedFieldNames();
- }
-
/**
* Gets the field names that have signatures and are signed.
*
@@ -2298,17 +2274,6 @@ public HashMap getSignatureTypes() {
return this.sigTypes;
}
- /**
- * Gets the field names that have blank signatures.
- *
- * @return the field names that have blank signatures
- * @deprecated use {@link AcroFields#getFieldNamesWithBlankSignatures()}
- */
- @Deprecated
- public ArrayList getBlankSignatureNames() {
- return (ArrayList) getFieldNamesWithBlankSignatures();
- }
-
/**
* Gets the field names that have blank signatures.
*
@@ -2433,7 +2398,7 @@ public PdfPKCS7 verifySignature(String name, String provider) {
try {
PdfName sub = v.getAsName(PdfName.SUBFILTER);
PdfString contents = v.getAsString(PdfName.CONTENTS);
- PdfPKCS7 pk;
+ PdfPKCS7 pk = null;
if (sub.equals(PdfName.ADBE_X509_RSA_SHA1)) {
PdfString cert = v.getAsString(PdfName.CERT);
pk = new PdfPKCS7(contents.getOriginalBytes(), cert.getBytes(), provider);
@@ -2564,50 +2529,6 @@ public boolean isAppend() {
return this.append;
}
- /**
- * Gets the appearances cache.
- *
- * @return the appearances cache
- * @since 2.1.5 this method used to return a HashMap
- * @deprecated use {@link AcroFields#getFieldCacheMap()}
- */
- @Deprecated
- public Map getFieldCache() {
- return fieldCache;
- }
-
- /**
- * Sets a cache for field appearances. Parsing the existing PDF to create a new TextField is time expensive. For
- * those tasks that repeatedly fill the same PDF with different field values the use of the cache has dramatic speed
- * advantages. An example usage:
- *
- *
- * String pdfFile = ...;// the pdf file used as template
- * ArrayList xfdfFiles = ...;// the xfdf file names
- * ArrayList pdfOutFiles = ...;// the output file names, one for each element in xpdfFiles
- * HashMap cache = new HashMap();// the appearances cache
- * PdfReader originalReader = new PdfReader(pdfFile);
- * for (int k = 0; k < xfdfFiles.size(); ++k) {
- * PdfReader reader = new PdfReader(originalReader);
- * XfdfReader xfdf = new XfdfReader((String)xfdfFiles.get(k));
- * PdfStamper stp = new PdfStamper(reader, new FileOutputStream((String)pdfOutFiles.get(k)));
- * AcroFields af = stp.getAcroFields();
- * af.setFieldCache(cache);
- * af.setFields(xfdf);
- * stp.close();
- * }
- *
- *
- * @param fieldCache a Map that will carry the cached appearances
- * @since 2.1.5 this method used to take a HashMap as parameter
- * @deprecated use {@link AcroFields#setFieldCacheMap(Map)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setFieldCache(Map fieldCache) {
- this.fieldCache = fieldCache;
- }
-
/**
* Gets the appearances cache.
*
@@ -2669,31 +2590,6 @@ public void addSubstitutionFont(BaseFont font) {
substitutionFonts.add(font);
}
- /**
- * Gets the list of substitution fonts. The list is composed of BaseFont and can be null.
- * The fonts in this list will be used if the original font doesn't contain the needed glyphs.
- *
- * @return the list
- * @deprecated use {@link AcroFields#getAllSubstitutionFonts()}
- */
- @Deprecated
- public ArrayList getSubstitutionFonts() {
- return (ArrayList) substitutionFonts;
- }
-
- /**
- * Sets a list of substitution fonts. The list is composed of BaseFont and can also be
- * null. The fonts in this list will be used if the original font doesn't contain the needed glyphs.
- *
- * @param substitutionFonts the list
- * @deprecated use {@link AcroFields#setAllSubstitutionFonts(List)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setSubstitutionFonts(ArrayList substitutionFonts) {
- this.substitutionFonts = substitutionFonts;
- }
-
/**
* Gets the list of substitution fonts. The list is composed of BaseFont and can be null.
* The fonts in this list will be used if the original font doesn't contain the needed glyphs.
@@ -2911,55 +2807,35 @@ public static class Item {
*
* @since 2.1.5
*/
-
public static final int WRITE_VALUE = 4;
- /**
- * The indirect reference of the item itself
- */
- private final PdfIndirectReference fieldReference;
/**
* An array of PdfDictionary where the value tag /V is present.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList values = new ArrayList<>();
+ ArrayList values = new ArrayList<>();
/**
* An array of PdfDictionary with the widgets.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList widgets = new ArrayList<>();
+ ArrayList widgets = new ArrayList<>();
/**
* An array of PdfDictionary with the widget references.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList widgetRefs = new ArrayList<>();
+ ArrayList widgetRefs = new ArrayList<>();
/**
* An array of PdfDictionary with all the field and widget tags merged.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList merged = new ArrayList<>();
+ ArrayList merged = new ArrayList<>();
/**
* An array of Integer with the page numbers where the widgets are displayed.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList page = new ArrayList<>();
+ ArrayList page = new ArrayList<>();
/**
* An array of Integer with the tab order of the field in the page.
- *
- * @deprecated (will remove ' public ' in the future)
*/
- @Deprecated
- public ArrayList tabOrder = new ArrayList<>();
-
+ ArrayList tabOrder = new ArrayList<>();
+ /**
+ * The indirect reference of the item itself
+ */
+ private PdfIndirectReference fieldReference;
public Item(PdfIndirectReference ref) {
this.fieldReference = ref;
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/BaseField.java b/openpdf/src/main/java/com/lowagie/text/pdf/BaseField.java
index 08267e45c..1c183a64d 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/BaseField.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/BaseField.java
@@ -312,16 +312,6 @@ protected static PdfAppearance getBorderAppearance(PdfWriter writer, Rectangle b
return app;
}
- /**
- * @param text text
- * @return an {@link ArrayList} of {@link String}
- * @deprecated use {@link BaseField#getAllHardBreaks(String)}
- */
- @Deprecated
- protected static ArrayList getHardBreaks(String text) {
- return (ArrayList) getAllHardBreaks(text);
- }
-
protected static List getAllHardBreaks(String text) {
List arr = new ArrayList<>();
char[] cs = text.toCharArray();
@@ -359,12 +349,6 @@ protected static void trimRight(StringBuffer buf) {
}
}
- @Deprecated
- @SuppressWarnings("unchecked")
- protected static ArrayList breakLines(ArrayList breaks, BaseFont font, float fontSize, float width) {
- return (ArrayList) breakLines((List) breaks, font, fontSize, width);
- }
-
protected static List breakLines(List breaks, BaseFont font, float fontSize, float width) {
List lines = new ArrayList<>();
StringBuffer buf = new StringBuffer();
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/BidiLine.java b/openpdf/src/main/java/com/lowagie/text/pdf/BidiLine.java
index 5089134e7..d49263098 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/BidiLine.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/BidiLine.java
@@ -533,16 +533,6 @@ public void addChunk(PdfChunk chunk) {
chunks.add(chunk);
}
- /**
- * @param chunks an {@link ArrayList} of {@link PdfChunk}
- * @deprecated use {@link BidiLine#addChunks(List)}, since 1.2.22
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void addChunks(ArrayList chunks) {
- addChunks((List) chunks);
- }
-
public void addChunks(List chunks) {
this.chunks.addAll(chunks);
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/CMapAwareDocumentFont.java b/openpdf/src/main/java/com/lowagie/text/pdf/CMapAwareDocumentFont.java
index 8b185eb11..db5695518 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/CMapAwareDocumentFont.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/CMapAwareDocumentFont.java
@@ -296,19 +296,4 @@ public String decode(char c) throws Error {
}
return result;
}
-
- /**
- * Encodes bytes to a String.
- *
- * @param bytes the bytes from a stream
- * @param offset an offset
- * @param len a length
- * @return a String encoded taking into account if the bytes are in unicode or not.
- * @deprecated method name is not indicative of what it does. Use
- * decode instead.
- */
- @Deprecated
- public String encode(byte[] bytes, int offset, int len) {
- return decode(bytes, offset, len);
- }
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/FdfReader.java b/openpdf/src/main/java/com/lowagie/text/pdf/FdfReader.java
index e4b6f264c..223cfc12a 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/FdfReader.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/FdfReader.java
@@ -122,7 +122,7 @@ protected void readPdf() throws IOException {
protected void kidNode(PdfDictionary merged, String name) {
PdfArray kids = merged.getAsArray(PdfName.KIDS);
if (kids == null || kids.isEmpty()) {
- if (name.isEmpty()) {
+ if (!name.isEmpty()) {
name = name.substring(1);
}
fields.put(name, merged);
@@ -164,18 +164,6 @@ protected void readFields() {
kidNode(merged, "");
}
- /**
- * Gets all the fields. The map is keyed by the fully qualified field name and the value is a merged
- * PdfDictionary with the field content.
- *
- * @return all the fields
- * @deprecated use {@link #getAllFields()}
- */
- @Deprecated
- public HashMap getFields() {
- return (HashMap) fields;
- }
-
/**
* Gets all the fields. The map is keyed by the fully qualified field name and the value is a merged
* PdfDictionary with the field content.
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/FieldReader.java b/openpdf/src/main/java/com/lowagie/text/pdf/FieldReader.java
index 7e906634e..ab60053e0 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/FieldReader.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/FieldReader.java
@@ -1,6 +1,5 @@
package com.lowagie.text.pdf;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -9,9 +8,6 @@
*/
public interface FieldReader {
- @Deprecated
- HashMap getFields();
-
Map getAllFields();
String getFieldValue(String fieldKey);
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/MappedRandomAccessFile.java b/openpdf/src/main/java/com/lowagie/text/pdf/MappedRandomAccessFile.java
index 3a58e88a1..f00cfe5b1 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/MappedRandomAccessFile.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/MappedRandomAccessFile.java
@@ -51,14 +51,13 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
/**
* A {@link java.nio.MappedByteBuffer} wrapped as a {@link java.io.RandomAccessFile}
@@ -102,49 +101,25 @@ public static boolean clean(final java.nio.ByteBuffer buffer) {
if (buffer == null || !buffer.isDirect()) {
return false;
}
+ return cleanJava11(buffer);
- if (cleanJava9(buffer)) {
- return true;
- }
- return cleanOldsJDK(buffer);
- }
-
- private static boolean cleanOldsJDK(final java.nio.ByteBuffer buffer) {
- return AccessController.doPrivileged((PrivilegedAction) () -> {
- Boolean success = Boolean.FALSE;
- try {
- Method getCleanerMethod = buffer.getClass().getMethod("cleaner", (Class[]) null);
- if (!getCleanerMethod.isAccessible()) {
- getCleanerMethod.setAccessible(true);
- }
- Object cleaner = getCleanerMethod.invoke(buffer, (Object[]) null);
- Method clean = cleaner.getClass().getMethod("clean", (Class[]) null);
- clean.invoke(cleaner, (Object[]) null);
- success = Boolean.TRUE;
- } catch (Exception e) {
- // Ignore
- }
- return success;
- });
}
- private static boolean cleanJava9(final java.nio.ByteBuffer buffer) {
- return AccessController.doPrivileged((PrivilegedAction) () -> {
- Boolean success = Boolean.FALSE;
- try {
- final Class> unsafeClass = Class.forName("sun.misc.Unsafe");
- final Field theUnsafeField = unsafeClass.getDeclaredField("theUnsafe");
- theUnsafeField.setAccessible(true);
- final Object theUnsafe = theUnsafeField.get(null);
- final Method invokeCleanerMethod = unsafeClass
- .getMethod("invokeCleaner", ByteBuffer.class);
- invokeCleanerMethod.invoke(theUnsafe, buffer);
- success = Boolean.TRUE;
- } catch (Exception ignore) {
- // Ignore
- }
- return success;
- });
+ private static boolean cleanJava11(final ByteBuffer buffer) {
+ Boolean success = Boolean.FALSE;
+ try {
+ MethodHandles.Lookup lookup = MethodHandles.lookup();
+ Class> unsafeClass = Class.forName("sun.misc.Unsafe");
+ MethodHandle methodHandle = lookup.findStatic(unsafeClass, "getUnsafe", MethodType.methodType(unsafeClass));
+ Object theUnsafe = methodHandle.invoke();
+ MethodHandle invokeCleanerMethod = lookup.findVirtual(unsafeClass, "invokeCleaner",
+ MethodType.methodType(void.class, ByteBuffer.class));
+ invokeCleanerMethod.invoke(theUnsafe, buffer);
+ success = Boolean.TRUE;
+ } catch (Throwable ignore) {
+ // Ignore
+ }
+ return success;
}
/**
@@ -255,10 +230,10 @@ public void close() throws IOException {
* @see java.lang.Object#finalize()
*/
@Override
+ @Deprecated(since = "OpenPDF-2.0.2", forRemoval = true)
protected void finalize() throws Throwable {
close();
super.finalize();
}
-
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java
index 55993525c..c6e738570 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java
@@ -96,17 +96,6 @@ public void setNeedAppearances(boolean value) {
put(PdfName.NEEDAPPEARANCES, new PdfBoolean(value));
}
- /**
- * Adds fieldTemplates.
- *
- * @param ft field templates
- * @deprecated use {@link #addFieldTemplates(Map)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void addFieldTemplates(HashMap ft) {
- fieldTemplates.putAll(ft);
- }
/**
* Adds fieldTemplates.
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfArray.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfArray.java
index 3bc258ea8..6bf5218ec 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfArray.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfArray.java
@@ -238,17 +238,6 @@ public boolean remove(PdfObject object) {
return this.arrayList.remove(object);
}
- /**
- * Get a copy the internal list for this PdfArray.
- *
- * @return a copy of the the internal List.
- * @deprecated Please use getElements() instead.
- */
- @Deprecated
- public List getArrayList() {
- return getElements();
- }
-
/**
* Get a copy the internal list for this PdfArray.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopy.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopy.java
index dcdb79eb2..d8f7bba7d 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopy.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopy.java
@@ -493,6 +493,7 @@ public PdfIndirectReference add(PdfOutline outline) {
return null;
}
+ @Override
public void addAnnotation(PdfAnnotation annot) {
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java
index 378d7226a..bf7c9f0fd 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopyFieldsImp.java
@@ -313,15 +313,6 @@ private void adjustTabOrder(PdfArray annots, PdfIndirectReference ind, PdfNumber
}
}
- /**
- * @deprecated use {@link PdfCopyFieldsImp#branchForm(Map, PdfIndirectReference, String)}
- */
- @Deprecated
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected PdfArray branchForm(HashMap level, PdfIndirectReference parent, String fname) throws IOException {
- return branchForm((Map) level, parent, fname);
- }
-
protected PdfArray branchForm(Map level, PdfIndirectReference parent, String fname)
throws IOException {
PdfArray arr = new PdfArray();
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfFormField.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfFormField.java
index 5df35013b..9de6ac855 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfFormField.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfFormField.java
@@ -305,15 +305,6 @@ public void addKid(PdfFormField field) {
kids.add(field);
}
- /**
- * @return an ArrayList of the kids
- * @deprecated use {@link #getKidFields()}
- */
- @Deprecated
- public ArrayList getKids() {
- return (ArrayList) kids;
- }
-
public List getKidFields() {
return kids;
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
index eb1c47701..944e4503f 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
@@ -188,7 +188,7 @@ public class PdfPKCS7 {
algorithmNames.put("1.3.36.3.3.1.3", "RSA");
algorithmNames.put("1.3.36.3.3.1.2", "RSA");
algorithmNames.put("1.3.36.3.3.1.4", "RSA");
- algorithmNames.put("1.2.840.10045.2.1", "ECDSA");
+ algorithmNames.put("1.2.840.10045.2.1", "ECDSA");
algorithmNames.put("1.2.840.10045.4.1", "ECDSA"); //SHA1
algorithmNames.put("1.2.840.10045.4.3", "ECDSA"); //SHA2
algorithmNames.put("1.2.840.10045.4.3.1", "ECDSA"); //SHA224
@@ -196,7 +196,7 @@ public class PdfPKCS7 {
algorithmNames.put("1.2.840.10045.4.3.3", "ECDSA"); //SHA384
algorithmNames.put("1.2.840.10045.4.3.4", "ECDSA"); //SHA512
algorithmNames.put("1.2.840.113549.1.1.10", "RSAandMGF1");
-
+
allowedDigests.put("MD5", "1.2.840.113549.2.5");
allowedDigests.put("MD2", "1.2.840.113549.2.2");
allowedDigests.put("SHA1", "1.3.14.3.2.26");
@@ -220,7 +220,7 @@ public class PdfPKCS7 {
//all oids according to http://oidref.com/1.2.840.113549.1.1
rsaOids.put("SHA256", "1.2.840.113549.1.1.11");
- //add a 2nd time with "-" due to different crypto providers (sun vs bc)
+ //add a 2nd time with "-" due to different crypto providers (sun vs bc)
rsaOids.put("SHA-256", "1.2.840.113549.1.1.11");
rsaOids.put("SHA384", "1.2.840.113549.1.1.12");
rsaOids.put("SHA-384", "1.2.840.113549.1.1.12");
@@ -232,7 +232,7 @@ public class PdfPKCS7 {
rsaOids.put("SHA3-256", "2.16.840.1.101.3.4.3.14");
rsaOids.put("SHA3-384", "2.16.840.1.101.3.4.3.15");
rsaOids.put("SHA3-512", "2.16.840.1.101.3.4.3.16");
-
+
dsaOids.put("SHA224", "2.16.840.1.101.3.4.3.1");
dsaOids.put("SHA-224", "2.16.840.1.101.3.4.3.1");
dsaOids.put("SHA256", "2.16.840.1.101.3.4.3.2");
@@ -247,7 +247,7 @@ public class PdfPKCS7 {
dsaOids.put("SHA3-256", "2.16.840.1.101.3.4.3.6");
dsaOids.put("SHA3-384", "2.16.840.1.101.3.4.3.7");
dsaOids.put("SHA3-512", "2.16.840.1.101.3.4.3.8");
-
+
ecdsaOids.put("SHA1", "1.2.840.10045.4.1");
ecdsaOids.put("SHA224", "1.2.840.10045.4.3.1");
ecdsaOids.put("SHA-224", "1.2.840.10045.4.3.1");
@@ -563,12 +563,13 @@ public PdfPKCS7(PrivateKey privKey, Certificate[] certChain, CRL[] crlList,
}
if (privKey != null) {
- // Now we have private key, find out what the digestEncryptionAlgorithm is.
+ // Now we have private key, find out what the digestEncryptionAlgorithm is.
String signingAlgorithm = privKey.getAlgorithm();
this.digestEncryptionAlgorithm = getOidForAlgorithmAndHash(signingAlgorithm, hashAlgorithm);
-
+
if (this.digestEncryptionAlgorithm == null) {
- throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown key algorithm " + this.digestEncryptionAlgorithm + " and hash " + hashAlgorithm));
+ throw new ExceptionConverter(new NoSuchAlgorithmException(
+ "Unknown key algorithm " + this.digestEncryptionAlgorithm + " and hash " + hashAlgorithm));
}
}
if (hasRSAdata) {
@@ -590,52 +591,55 @@ public PdfPKCS7(PrivateKey privKey, Certificate[] certChain, CRL[] crlList,
sig.initSign(privKey);
}
}
-
+
/**
* Determines an OID by signing and hash algorithm. If nothing is found null will be returned.
*
- * @param signingAlgorithm - currently RSA, DSA and ECDSA are supported.
- * @param hashAlgorithm like SHA1, SHA2 or SHA3
+ * @param signingAlgorithm - currently RSA, DSA and ECDSA are supported.
+ * @param hashAlgorithm like SHA1, SHA2 or SHA3
*/
private static String getOidForAlgorithmAndHash(String signingAlgorithm, String hashAlgorithm) {
-
+
String returnValue;
-
+
switch (signingAlgorithm) {
- case "RSA": returnValue = rsaOids.get(hashAlgorithm);
- //fallback
- if (returnValue == null) {
- returnValue = ID_RSA;
- }
- break;
- case "DSA": returnValue = dsaOids.get(hashAlgorithm);
- //fallback
- if (returnValue == null) {
- returnValue = ID_DSA;
- }
- break;
+ case "RSA":
+ returnValue = rsaOids.get(hashAlgorithm);
+ //fallback
+ if (returnValue == null) {
+ returnValue = ID_RSA;
+ }
+ break;
+ case "DSA":
+ returnValue = dsaOids.get(hashAlgorithm);
+ //fallback
+ if (returnValue == null) {
+ returnValue = ID_DSA;
+ }
+ break;
case "EC":
- case "ECDSA": returnValue = ecdsaOids.get(hashAlgorithm);
- //fallback
- if (returnValue == null) {
- returnValue = ID_ECDSA;
- }
- break;
- default: returnValue = null;
+ case "ECDSA":
+ returnValue = ecdsaOids.get(hashAlgorithm);
+ //fallback
+ if (returnValue == null) {
+ returnValue = ID_ECDSA;
+ }
+ break;
+ default:
+ returnValue = null;
}
-
+
if (returnValue == null) {
//nothing found so check BC
DefaultSignatureAlgorithmIdentifierFinder finder = new DefaultSignatureAlgorithmIdentifierFinder();
try {
AlgorithmIdentifier id = finder.find(hashAlgorithm + "with" + signingAlgorithm);
returnValue = id.getAlgorithm().getId();
- }
- catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException iae) {
//it was just a try, return null then
}
}
-
+
return returnValue;
}
@@ -1334,10 +1338,12 @@ public void setExternalDigest(byte[] digest, byte[] RSAdata,
this.externalRSAdata = RSAdata;
if (digestEncryptionAlgorithm != null) {
String hashAlgorithm = getHashAlgorithm();
- this.digestEncryptionAlgorithm = PdfPKCS7.getOidForAlgorithmAndHash(digestEncryptionAlgorithm, hashAlgorithm);
-
+ this.digestEncryptionAlgorithm = PdfPKCS7.getOidForAlgorithmAndHash(digestEncryptionAlgorithm,
+ hashAlgorithm);
+
if (this.digestEncryptionAlgorithm == null) {
- throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown key algorithm " + digestEncryptionAlgorithm + " hash " + hashAlgorithm));
+ throw new ExceptionConverter(new NoSuchAlgorithmException(
+ "Unknown key algorithm " + digestEncryptionAlgorithm + " hash " + hashAlgorithm));
}
}
}
@@ -1796,8 +1802,6 @@ public static class X509Name {
/**
* A HashMap with default symbols
*/
- @Deprecated
- public static HashMap DefaultSymbols = new HashMap();
public static Map defaultSymbols = new HashMap<>();
static {
@@ -1817,14 +1821,11 @@ public static class X509Name {
defaultSymbols.put(INITIALS, "INITIALS");
defaultSymbols.put(GENERATION, "GENERATION");
- DefaultSymbols.putAll(defaultSymbols);
}
/**
* A HashMap with values
*/
- @Deprecated
- public HashMap values = new HashMap();
public Map> valuesMap = new HashMap<>();
/**
@@ -1882,18 +1883,6 @@ public String getField(String name) {
return vs == null ? null : vs.get(0);
}
- /**
- * gets a field array from the values Hashmap
- *
- * @param name the name of the field to get
- * @return an ArrayList
- * @deprecated use {@link #getFieldsByName(String)}
- */
- @Deprecated
- public ArrayList getFieldArray(String name) {
- return (ArrayList) valuesMap.get(name);
- }
-
/**
* gets a field array from the values Hashmap
*
@@ -1904,17 +1893,6 @@ public List getFieldsByName(String name) {
return valuesMap.get(name);
}
- /**
- * getter for values
- *
- * @return a HashMap with the fields of the X509 name
- * @deprecated use {@link #getAllFields()}
- */
- @Deprecated
- public HashMap getFields() {
- return (HashMap) valuesMap;
- }
-
/**
* getter for values
*
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java
index 0573dbccd..df82d1539 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java
@@ -187,9 +187,8 @@ protected PdfPTable() {
*/
public PdfPTable(float[] relativeWidths) {
if (relativeWidths == null) {
- throw new NullPointerException(
- MessageLocalization.getComposedMessage(
- "the.widths.array.in.pdfptable.constructor.can.not.be.null"));
+ throw new NullPointerException(MessageLocalization.getComposedMessage(
+ "the.widths.array.in.pdfptable.constructor.can.not.be.null"));
}
if (relativeWidths.length == 0) {
throw new IllegalArgumentException(MessageLocalization.getComposedMessage(
@@ -498,7 +497,7 @@ public PdfPCell getDefaultCell() {
*
* @param cell the cell element
*/
- public void addCell(PdfPCell cell) {
+ public PdfPCell addCell(PdfPCell cell) {
rowCompleted = false;
PdfPCell ncell = new PdfPCell(cell);
@@ -556,6 +555,8 @@ public void addCell(PdfPCell cell) {
currentRow[currentRowIdx] = ncell;
currentRowIdx += colspan;
}
+
+ return ncell;
}
/**
@@ -645,8 +646,8 @@ boolean rowSpanAbove(int currRow, int currCol) {
*
* @param text the text for the cell
*/
- public void addCell(String text) {
- addCell(new Phrase(text));
+ public PdfPCell addCell(String text) {
+ return addCell(new Phrase(text));
}
/**
@@ -654,10 +655,11 @@ public void addCell(String text) {
*
* @param table the table to be added to the cell
*/
- public void addCell(PdfPTable table) {
+ public PdfPCell addCell(PdfPTable table) {
defaultCell.setTable(table);
addCell(defaultCell);
defaultCell.setTable(null);
+ return defaultCell;
}
/**
@@ -665,10 +667,11 @@ public void addCell(PdfPTable table) {
*
* @param image the Image to add to the table. This image will fit in the cell
*/
- public void addCell(Image image) {
+ public PdfPCell addCell(Image image) {
defaultCell.setImage(image);
addCell(defaultCell);
defaultCell.setImage(null);
+ return defaultCell;
}
/**
@@ -676,10 +679,11 @@ public void addCell(Image image) {
*
* @param phrase the Phrase to be added to the cell
*/
- public void addCell(Phrase phrase) {
+ public PdfPCell addCell(Phrase phrase) {
defaultCell.setPhrase(phrase);
addCell(defaultCell);
defaultCell.setPhrase(null);
+ return defaultCell;
}
/**
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamper.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamper.java
index 3d41d58b9..83f608009 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamper.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamper.java
@@ -278,30 +278,6 @@ public static PdfStamper createSignature(PdfReader reader, OutputStream os, char
return createSignature(reader, os, pdfVersion, tempFile, false);
}
- /**
- * Gets the optional String map to add or change values in the info dictionary.
- *
- * @return the map or null
- * @deprecated use {@link #getInfoDictionary()}
- */
- @Deprecated
- public HashMap getMoreInfo() {
- return (HashMap) this.moreInfo;
- }
-
- /**
- * An optional String map to add or change values in the info dictionary. Entries with
- * null values delete the key in the original info dictionary
- *
- * @param moreInfo additional entries to the info dictionary
- * @deprecated use {@link #setInfoDictionary(Map)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setMoreInfo(HashMap moreInfo) {
- this.moreInfo = moreInfo;
- }
-
/**
* Gets the optional String map to add or change values in the info dictionary.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java
index 399d5f6c8..495e74b8a 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java
@@ -1474,7 +1474,7 @@ private void addAnnotationToDocument(PdfAnnotation annot) {
if (annot.isForm()) {
fieldsAdded = true;
getAcroFields();
- //@sonatype-lift ignore since before 'isForm' is called
+ //@sonatype-lift ignore since before 'isForm' is called
PdfFormField field = (PdfFormField) annot;
if (field.getParent() != null) {
return;
@@ -1498,7 +1498,7 @@ private void addAnnotationToDocument(PdfAnnotation annot) {
fieldTemplates.putAll(templates);
}
}
- //@sonatype-lift ignore since before 'isForm' is called
+ //@sonatype-lift ignore since before 'isForm' is called
PdfFormField field = (PdfFormField) annot;
if (field.getParent() == null) {
addDocumentField(field.getIndirectReference());
@@ -1690,6 +1690,7 @@ void setOutlines() throws IOException {
* @param preferences the viewer preferences
* @see PdfWriter#setViewerPreferences(int)
*/
+ @Override
public void setViewerPreferences(int preferences) {
useVp = true;
this.viewerPreferences.setViewerPreferences(preferences);
@@ -1702,6 +1703,7 @@ public void setViewerPreferences(int preferences) {
* @param value the value for the viewer preference
* @see PdfViewerPreferences#addViewerPreference
*/
+ @Override
public void addViewerPreference(PdfName key, PdfObject value) {
useVp = true;
this.viewerPreferences.addViewerPreference(key, value);
@@ -1712,6 +1714,7 @@ public void addViewerPreference(PdfName key, PdfObject value) {
*
* @param f the flags. This flags are ORed with current ones
*/
+ @Override
public void setSigFlags(int f) {
sigFlags |= f;
}
@@ -1724,6 +1727,7 @@ public void setSigFlags(int f) {
* @throws PdfException ignore
* @see PdfStamper#setPageAction(PdfName, PdfAction, int)
*/
+ @Override
public void setPageAction(PdfName actionType, PdfAction action) throws PdfException {
throw new UnsupportedOperationException(MessageLocalization.getComposedMessage(
"use.setpageaction.pdfname.actiontype.pdfaction.action.int.page"));
@@ -1759,6 +1763,7 @@ void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfExc
*
* @param seconds ignore
*/
+ @Override
public void setDuration(int seconds) {
throw new UnsupportedOperationException(MessageLocalization.getComposedMessage(
"use.setpageaction.pdfname.actiontype.pdfaction.action.int.page"));
@@ -1769,6 +1774,7 @@ public void setDuration(int seconds) {
*
* @param transition ignore
*/
+ @Override
public void setTransition(PdfTransition transition) {
throw new UnsupportedOperationException(MessageLocalization.getComposedMessage(
"use.setpageaction.pdfname.actiontype.pdfaction.action.int.page"));
@@ -1845,6 +1851,7 @@ boolean isAppend() {
* @param action the action to execute in response to the trigger
* @throws PdfException on invalid action type
*/
+ @Override
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException {
if (!(actionType.equals(DOCUMENT_CLOSE) ||
actionType.equals(WILL_SAVE) ||
@@ -1873,6 +1880,7 @@ public void setAdditionalAction(PdfName actionType, PdfAction action) throws Pdf
/**
* @see com.lowagie.text.pdf.PdfWriter#setOpenAction(com.lowagie.text.pdf.PdfAction)
*/
+ @Override
public void setOpenAction(PdfAction action) {
openAction = action;
}
@@ -1880,6 +1888,7 @@ public void setOpenAction(PdfAction action) {
/**
* @see com.lowagie.text.pdf.PdfWriter#setOpenAction(java.lang.String)
*/
+ @Override
public void setOpenAction(String name) {
throw new UnsupportedOperationException(
MessageLocalization.getComposedMessage("open.actions.by.name.are.not.supported"));
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java
index c1ef4945e..57933f284 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java
@@ -455,65 +455,6 @@ public class PdfWriter extends DocWriter implements
* @since 2.0.7
*/
public static final int ALLOW_DEGRADED_PRINTING = 4;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_PRINTING} instead. Scheduled for removal at or after 2.2.0
- */
- @Deprecated
- public static final int AllowPrinting = ALLOW_PRINTING;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_CONTENTS} instead. Scheduled for removal at or after
- * 2.2.0
- */
- @Deprecated
- public static final int AllowModifyContents = ALLOW_MODIFY_CONTENTS;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_COPY} instead. Scheduled for removal at or after 2.2.0
- */
- @Deprecated
- public static final int AllowCopy = ALLOW_COPY;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_ANNOTATIONS} instead. Scheduled for removal at or after
- * 2.2.0
- */
- @Deprecated
- public static final int AllowModifyAnnotations = ALLOW_MODIFY_ANNOTATIONS;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_FILL_IN} instead. Scheduled for removal at or after 2.2.0
- */
- @Deprecated
- public static final int AllowFillIn = ALLOW_FILL_IN;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_SCREENREADERS} instead. Scheduled for removal at or after 2.2.0
- */
- @Deprecated
- public static final int AllowScreenReaders = ALLOW_SCREENREADERS;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_ASSEMBLY} instead. Scheduled for removal at or after 2.2.0
- */
- @Deprecated
- public static final int AllowAssembly = ALLOW_ASSEMBLY;
- /**
- * @deprecated As of iText 2.0.7, use {@link #ALLOW_DEGRADED_PRINTING} instead. Scheduled for removal at or after
- * 2.2.0
- */
- @Deprecated
- public static final int AllowDegradedPrinting = ALLOW_DEGRADED_PRINTING;
-
-// [C3] PdfViewerPreferences interface
-
- // page layout (section 13.1.1 of "iText in Action")
- /**
- * @deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_40} instead. Scheduled for removal at or after
- * 2.2.0
- */
- @Deprecated
- public static final boolean STRENGTH40BITS = false;
- /**
- * @deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_128} instead. Scheduled for removal at or after
- * 2.2.0
- */
- @Deprecated
- public static final boolean STRENGTH128BITS = true;
/**
* action value
*/
@@ -530,8 +471,6 @@ public class PdfWriter extends DocWriter implements
* Disable the inter-character spacing.
*/
public static final float NO_SPACE_CHAR_RATIO = 10000000f;
-
- // page mode (section 13.1.2 of "iText in Action")
/**
* Use the default run direction.
*/
@@ -548,6 +487,10 @@ public class PdfWriter extends DocWriter implements
* Use bidirectional reordering with right-to-left preferential run direction.
*/
public static final int RUN_DIRECTION_RTL = 3;
+
+// [C3] PdfViewerPreferences interface
+
+ // page layout (section 13.1.1 of "iText in Action")
/**
* Mask to separate the encryption type from the encryption mode.
*/
@@ -556,8 +499,6 @@ public class PdfWriter extends DocWriter implements
* Stores the PDF/X level.
*/
private final PdfXConformanceImp pdfxConformance = new PdfXConformanceImp();
-
- // values for setting viewer preferences in iText versions older than 2.x
/**
* This is the list with all the images in the document.
*/
@@ -574,6 +515,8 @@ public class PdfWriter extends DocWriter implements
* The direct content under in this document.
*/
protected PdfContentByte directContentUnder;
+
+ // page mode (section 13.1.2 of "iText in Action")
/**
* body of the PDF document
*/
@@ -600,6 +543,8 @@ public class PdfWriter extends DocWriter implements
* @since 2.1.5
*/
protected PdfName tabs = null;
+
+ // values for setting viewer preferences in iText versions older than 2.x
/**
* A number referring to the previous Cross-Reference Table.
*/
@@ -617,14 +562,10 @@ public class PdfWriter extends DocWriter implements
* Contains the business logic for cryptography.
*/
protected PdfEncryption crypto;
-
-// [C4] Page labels
/**
* Holds value of property fullCompression.
*/
protected boolean fullCompression = false;
-
-// [C5] named objects: named destinations, javascript, embedded files
/**
* The compression level of the content streams.
*
@@ -657,16 +598,18 @@ public class PdfWriter extends DocWriter implements
* The color number counter for the colors in the document.
*/
protected int colorNumber = 1;
+
+// [C4] Page labels
/**
* The patterns of this document
*/
protected HashMap documentPatterns = new HashMap<>();
+
+// [C5] named objects: named destinations, javascript, embedded files
/**
* The pattern number counter for the colors in the document.
*/
protected int patternNumber = 1;
-
- // [C6] Actions (open and additional)
protected HashMap documentShadingPatterns = new HashMap<>();
protected HashMap documentShadings = new HashMap<>();
protected HashMap documentExtGState = new LinkedHashMap<>();
@@ -681,18 +624,16 @@ public class PdfWriter extends DocWriter implements
* An array list used to define the order of an OCG tree.
*/
protected List documentOCGorder = new ArrayList<>();
-
-// [C7] portable collections
/**
* The OCProperties in a catalog dictionary.
*/
protected PdfOCProperties OCProperties;
-
-// [C8] AcroForm
/**
* The RBGroups array in an OCG dictionary
*/
protected PdfArray OCGRadioGroup = new PdfArray();
+
+// [C6] Actions (open and additional)
/**
* The locked array in an OCG dictionary
*
@@ -708,11 +649,13 @@ public class PdfWriter extends DocWriter implements
protected float userunit = 0f;
protected PdfDictionary defaultColorspace = new PdfDictionary();
protected HashMap documentSpotPatterns = new HashMap<>();
-
- // [C9] Metadata
protected ColorDetails patternColorspaceRGB;
protected ColorDetails patternColorspaceGRAY;
+
+ // [C7] portable collections
protected ColorDetails patternColorspaceCMYK;
+
+// [C8] AcroForm
/**
* Dictionary, containing all the images of the PDF document
*/
@@ -723,8 +666,6 @@ public class PdfWriter extends DocWriter implements
* @since 2.1.5
*/
protected HashMap JBIG2Globals = new HashMap<>();
-
-// [C10] PDFX Conformance
/**
* The PdfPageEvent for this document.
*/
@@ -749,6 +690,8 @@ public class PdfWriter extends DocWriter implements
protected PdfWriter() {
}
+// [C9] Metadata
+
/**
* Constructs a PdfWriter.
*
@@ -837,7 +780,7 @@ private static void getOCGOrder(PdfArray order, PdfLayer layer) {
}
}
-// [C11] Output intents
+// [C10] PDFX Conformance
/**
* Gets the PdfDocument associated with this writer.
@@ -885,12 +828,6 @@ public void setInitialLeading(float leading) throws DocumentException {
pdf.setLeading(leading);
}
-// PDF Objects that have an impact on the PDF body
-
-// [F1] PdfEncryptionSettings interface
-
- // types of encryption
-
/**
* Use this method to get the direct content for this document. There is only one direct content, multiple calls to
* this method will allways retrieve the same object.
@@ -950,8 +887,6 @@ void addLocalDestinations(TreeMap dest) throws IOException {
}
}
}
- // ENCRYPTION_* = 3 reserved for implementation of the
- // meanwhile deprecated proprietary AES256 variant by Adobe
/**
* Use this method to add a PDF object to the PDF body. Use this method only if you know what you're doing!
@@ -976,6 +911,8 @@ public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws IO
return body.add(object, inObjStm);
}
+// [C11] Output intents
+
/**
* Use this method to add a PDF object to the PDF body. Use this method only if you know what you're doing!
*
@@ -1002,8 +939,6 @@ public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref, b
return body.add(object, ref, inObjStm);
}
- // permissions
-
/**
* Use this method to add a PDF object to the PDF body. Use this method only if you know what you're doing!
*
@@ -1029,6 +964,12 @@ public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inOb
return body.add(object, refNumber, inObjStm);
}
+// PDF Objects that have an impact on the PDF body
+
+// [F1] PdfEncryptionSettings interface
+
+ // types of encryption
+
/**
* Use this to get an PdfIndirectReference for an object that will be created in the future. Use this
* method only if you know what you're doing!
@@ -1077,6 +1018,8 @@ protected PdfDictionary getCatalog(PdfIndirectReference rootObj) {
}
return catalog;
}
+ // ENCRYPTION_* = 3 reserved for implementation of the
+ // meanwhile deprecated proprietary AES256 variant by Adobe
/**
* Sets extra keys to the catalog.
@@ -1142,6 +1085,8 @@ public PdfIndirectReference getPageReference(int page) {
return ref;
}
+ // permissions
+
/**
* Gets the pagenumber of this document. This number can be different from the real pagenumber, if you have (re)set
* the page number previously.
@@ -1220,8 +1165,6 @@ PdfIndirectReference add(PdfPage page, PdfContents contents) throws PdfException
return null;
}
- // Strength of the encryption (kept for historical reasons)
-
/**
* Gets the PdfPageEvent for this document or null if none is set.
*
@@ -1444,6 +1387,8 @@ public PdfOutline getRootOutline() {
return directContent.getRootOutline();
}
+// [F2] compression
+
/**
* Sets the bookmarks. The list structure is defined in {@link SimpleBookmark}.
*
@@ -1470,13 +1415,10 @@ protected void writeOutlines(PdfDictionary catalog, boolean namedAsNames) throws
/**
* @see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char)
*/
- @Override
public void setAtLeastPdfVersion(char version) {
pdf_version.setAtLeastPdfVersion(version);
}
- // [F2] compression
-
/**
* @see com.lowagie.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.lowagie.text.pdf.PdfDeveloperExtension)
* @since 2.1.6
@@ -1526,8 +1468,6 @@ public void addViewerPreference(PdfName key, PdfObject value) {
pdf.addViewerPreference(key, value);
}
-// [F3] adding fonts
-
/**
* Use this method to add page labels
*
@@ -1537,6 +1477,8 @@ public void setPageLabels(PdfPageLabels pageLabels) {
pdf.setPageLabels(pageLabels);
}
+// [F4] adding (and releasing) form XObjects
+
/**
* Adds named destinations in bulk. Valid keys and values of the map can be found in the map that is created by
* SimpleNamedDestination.
@@ -1584,8 +1526,6 @@ public void addJavaScript(PdfAction js) {
pdf.addJavaScript(js);
}
-// [F4] adding (and releasing) form XObjects
-
/**
* Use this method to add a JavaScript action at the document level. When the document opens, all this JavaScript
* runs.
@@ -1598,6 +1538,8 @@ public void addJavaScript(String code, boolean unicode) {
addJavaScript(PdfAction.javaScript(code, this, unicode));
}
+// [F5] adding pages imported form other PDF documents
+
/**
* Use this method to adds a JavaScript action at the document level. When the document opens, all this JavaScript
* runs.
@@ -1632,8 +1574,6 @@ public void addJavaScript(String name, String code, boolean unicode) {
addJavaScript(name, PdfAction.javaScript(code, this, unicode));
}
-// [F5] adding pages imported form other PDF documents
-
/**
* Use this method to adds a JavaScript action at the document level. When the document opens, all this JavaScript
* runs.
@@ -1681,6 +1621,8 @@ public void addFileAttachment(PdfFileSpecification fs) throws IOException {
addFileAttachment(null, fs);
}
+// [F6] spot colors
+
/**
* @see com.lowagie.text.pdf.interfaces.PdfDocumentActions#setOpenAction(java.lang.String)
*/
@@ -1714,8 +1656,6 @@ public void setAdditionalAction(PdfName actionType, PdfAction action) throws Doc
pdf.addAdditionalAction(actionType, action);
}
-// [F6] spot colors
-
/**
* Use this method to add the Collection dictionary.
*
@@ -1726,6 +1666,8 @@ public void setCollection(PdfCollection collection) {
pdf.setCollection(collection);
}
+// [F7] document patterns
+
/**
* @see com.lowagie.text.pdf.interfaces.PdfAnnotations#getAcroForm()
*/
@@ -1746,7 +1688,7 @@ void addAnnotation(PdfAnnotation annot, int page) {
addAnnotation(annot);
}
-// [F7] document patterns
+// [F8] shading patterns
/**
* @see com.lowagie.text.pdf.interfaces.PdfAnnotations#addCalculationOrder(com.lowagie.text.pdf.PdfFormField)
@@ -1764,6 +1706,8 @@ public void setSigFlags(int f) {
pdf.setSigFlags(f);
}
+// [F9] document shadings
+
/**
* Use this method to set the XMP Metadata.
*
@@ -1773,8 +1717,6 @@ public void setXmpMetadata(byte[] xmpMetadata) {
this.xmpMetadata = xmpMetadata;
}
-// [F8] shading patterns
-
/**
* Use this method to set the XMP Metadata for each page.
*
@@ -1784,6 +1726,8 @@ public void setPageXmpMetadata(byte[] xmpMetadata) {
pdf.setXmpMetadata(xmpMetadata);
}
+// [F10] extended graphics state (for instance for transparency)
+
/**
* Use this method to creates XMP Metadata based on the metadata in the PdfDocument.
*/
@@ -1791,8 +1735,6 @@ public void createXmpMetadata() {
setXmpMetadata(createXmpMetadataBytes());
}
-// [F9] document shadings
-
/**
* @return an XmpMetadata byte array
*/
@@ -1807,6 +1749,8 @@ private byte[] createXmpMetadataBytes() {
return baos.toByteArray();
}
+// [F11] adding properties (OCG, marked content)
+
/**
* @see com.lowagie.text.pdf.interfaces.PdfXConformance#getPDFXConformance()
*/
@@ -1815,8 +1759,6 @@ public int getPDFXConformance() {
return pdfxConformance.getPDFXConformance();
}
-// [F10] extended graphics state (for instance for transparency)
-
/**
* @see com.lowagie.text.pdf.interfaces.PdfXConformance#setPDFXConformance(int)
*/
@@ -1850,7 +1792,7 @@ public boolean isPdfX() {
return pdfxConformance.isPdfX();
}
-// [F11] adding properties (OCG, marked content)
+// [F12] tagged PDF
public boolean isPdfA1() {
return pdfxConformance.isPdfA1();
@@ -1920,8 +1862,6 @@ public void setOutputIntents(String outputConditionIdentifier, String outputCond
setOutputIntents(outputConditionIdentifier, outputCondition, registryName, info, colorProfile);
}
-// [F12] tagged PDF
-
/**
* Use this method to copy the output intent dictionary from another document to this one.
*
@@ -1964,6 +1904,8 @@ PdfEncryption getEncryption() {
return crypto;
}
+// [F13] Optional Content Groups
+
/**
* @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int)
*/
@@ -1999,72 +1941,6 @@ public void setEncryption(Certificate[] certs, int[] permissions, int encryption
crypto.getEncryptionDictionary();
}
- /**
- * Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero
- * length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can
- * be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders,
- * AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.
- *
- * @param userPassword the user password. Can be null or empty
- * @param ownerPassword the owner password. Can be null or empty
- * @param permissions the user permissions
- * @param strength128Bits true for 128 bit key length, false for 40 bit key length
- * @throws DocumentException if the document is already open
- * @deprecated As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for
- * removal at or after 2.2.0
- */
- @Deprecated
- public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits)
- throws DocumentException {
- setEncryption(userPassword, ownerPassword, permissions,
- strength128Bits ? STANDARD_ENCRYPTION_128 : STANDARD_ENCRYPTION_40);
- }
-
-// [F13] Optional Content Groups
-
- /**
- * Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero
- * length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can
- * be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders,
- * AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.
- *
- * @param strength true for 128 bit key length, false for 40 bit key length
- * @param userPassword the user password. Can be null or empty
- * @param ownerPassword the owner password. Can be null or empty
- * @param permissions the user permissions
- * @throws DocumentException if the document is already open
- * @deprecated As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for
- * removal at or after 2.2.0
- */
- @Deprecated
- public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions)
- throws DocumentException {
- setEncryption(getISOBytes(userPassword), getISOBytes(ownerPassword), permissions,
- strength ? STANDARD_ENCRYPTION_128 : STANDARD_ENCRYPTION_40);
- }
-
- /**
- * Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero
- * length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can
- * be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders,
- * AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.
- *
- * @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or
- * ENCRYPTION_AES128. Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in
- * cleartext
- * @param userPassword the user password. Can be null or empty
- * @param ownerPassword the owner password. Can be null or empty
- * @param permissions the user permissions
- * @throws DocumentException if the document is already open
- * @deprecated As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for
- * removal at or after 2.2.0
- */
- @Deprecated
- public void setEncryption(int encryptionType, String userPassword, String ownerPassword, int permissions)
- throws DocumentException {
- setEncryption(getISOBytes(userPassword), getISOBytes(ownerPassword), permissions, encryptionType);
- }
-
/**
* Use this method to find out if 1.5 compression is on.
*
@@ -3479,7 +3355,7 @@ public boolean equals(Object obj) {
if (!(obj instanceof PdfCrossReference)) {
return false;
}
- final PdfCrossReference other = (PdfCrossReference) obj;
+ PdfCrossReference other = (PdfCrossReference) obj;
return refnum == other.refnum;
}
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/RadioCheckField.java b/openpdf/src/main/java/com/lowagie/text/pdf/RadioCheckField.java
index 280bb7030..c38e580a6 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/RadioCheckField.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/RadioCheckField.java
@@ -442,33 +442,6 @@ public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison)
return field;
}
- /**
- * Gets the radio field. It's only composed of the widget keys and must be used with
- * {@link #getRadioGroup(boolean, boolean)}.
- *
- * @return the radio field
- * @throws IOException on error
- * @throws DocumentException on error
- * @deprecated use {@link #getKidField()} instead
- */
- @Deprecated
- public PdfFormField getRadioField() throws IOException, DocumentException {
- return getField(true);
- }
-
- /**
- * Gets the check field.
- *
- * @return the check field
- * @throws IOException on error
- * @throws DocumentException on error
- * @deprecated use {@link #getFullField()} instead
- */
- @Deprecated
- public PdfFormField getCheckField() throws IOException, DocumentException {
- return getField(false);
- }
-
/**
* Gets a parent of a checkbox autofill parent. It is composed of the field specific keys, without the widget ones.
* This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) addKid()}.
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/SimpleBookmark.java b/openpdf/src/main/java/com/lowagie/text/pdf/SimpleBookmark.java
index be5c155b9..79f05a058 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/SimpleBookmark.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/SimpleBookmark.java
@@ -277,20 +277,6 @@ private static int getNumber(PdfIndirectReference indirect) {
return indirect.getNumber();
}
- /**
- * Gets a List with the bookmarks. It returns null if the document doesn't have any
- * bookmarks.
- *
- * @param reader the document
- * @return a List with the bookmarks or null if the document doesn't have any
- * @deprecated use {@link #getBookmarkList(PdfReader)}
- */
- @Deprecated
- @SuppressWarnings("rawtypes")
- public static List getBookmark(PdfReader reader) {
- return getBookmarkList(reader);
- }
-
/**
* Gets a List with the bookmarks. It returns null if the document doesn't have any
* bookmarks.
@@ -370,21 +356,6 @@ public static void eliminatePages(List> list, int[] pageRang
}
}
- /**
- * For the pages in range add the pageShift to the page number. The page ranges consists of a number of
- * pairs with the start/end page range. The page numbers are inclusive.
- *
- * @param list the bookmarks
- * @param pageShift the number to add to the pages in range
- * @param pageRange the page ranges, always in pairs. It can be null to include all the pages
- * @deprecated use {@link #shiftPageNumbersInRange(List, int, int[])}
- */
- @Deprecated
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static void shiftPageNumbers(List list, int pageShift, int[] pageRange) {
- shiftPageNumbersInRange(list, pageShift, pageRange);
- }
-
/**
* For the pages in range add the pageShift to the page number. The page ranges consists of a number of
* pairs with the start/end page range. The page numbers are inclusive.
@@ -793,15 +764,6 @@ public void endElement(String tag) {
public void startDocument() {
}
- /**
- * @deprecated user {@link SimpleBookmark#startElement(String, Map)}
- */
- @Deprecated
- @SuppressWarnings({"unchecked", "rawtypes"})
- public void startElement(String tag, HashMap h) {
- startElement(tag, (Map) h);
- }
-
public void startElement(String tag, Map h) {
if (topList == null) {
if (tag.equals("Bookmark")) {
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/SimpleNamedDestination.java b/openpdf/src/main/java/com/lowagie/text/pdf/SimpleNamedDestination.java
index c387b31b8..0b999fe3d 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/SimpleNamedDestination.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/SimpleNamedDestination.java
@@ -319,12 +319,6 @@ public void endElement(String tag) {
public void startDocument() {
}
- @Deprecated
- @SuppressWarnings("unchecked")
- public void startElement(String tag, HashMap h) {
- startElement(tag, (Map) h);
- }
-
public void startElement(String tag, Map h) {
if (xmlNames == null) {
if (tag.equals("Destination")) {
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/TextField.java b/openpdf/src/main/java/com/lowagie/text/pdf/TextField.java
index eed912e30..3003d4554 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/TextField.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/TextField.java
@@ -113,7 +113,7 @@ public TextField(PdfWriter writer, Rectangle box, String fieldName) {
}
private static boolean checkRTL(String text) {
- if (text == null || text.length() == 0) {
+ if (text == null || text.isEmpty()) {
return false;
}
char[] cc = text.toCharArray();
@@ -869,19 +869,6 @@ public void addChoiceSelection(int selection) {
}
}
- /**
- * replaces the existing selections with the param. If this field isn't a MULTISELECT list, all but the first
- * element will be removed.
- *
- * @param selections new selections. If null, it clear()s the underlying ArrayList.
- * @deprecated use {@link #setChoiceSelections(List)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setChoiceSelections(ArrayList selections) {
- setChoiceSelections((List) selections);
- }
-
/**
* replaces the existing selections with the param. If this field isn't a MULTISELECT list, all but the first
* element will be removed.
@@ -918,30 +905,6 @@ public void setExtraMargin(float extraMarginLeft, float extraMarginTop) {
this.extraMarginTop = extraMarginTop;
}
- /**
- * Gets the list of substitution fonts. The list is composed of BaseFont and can be null.
- * The fonts in this list will be used if the original font doesn't contain the needed glyphs.
- *
- * @return the list
- * @deprecated use {@link #getSubstitutionFontList()}
- */
- @Deprecated
- public ArrayList getSubstitutionFonts() {
- return (ArrayList) this.substitutionFonts;
- }
-
- /**
- * Sets a list of substitution fonts. The list is composed of BaseFont and can also be
- * null. The fonts in this list will be used if the original font doesn't contain the needed glyphs.
- *
- * @param substitutionFonts the list
- * @deprecated use {@link #setSubstitutionFontList(List)}
- */
- @Deprecated
- public void setSubstitutionFonts(List substitutionFonts) {
- this.substitutionFonts = substitutionFonts;
- }
-
/**
* Gets the list of substitution fonts. The list is composed of BaseFont and can be null.
* The fonts in this list will be used if the original font doesn't contain the needed glyphs.
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java b/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java
index b14b580d0..08b67d498 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java
@@ -723,20 +723,6 @@ public static String getShortName(String s) {
return sb.toString();
}
- /**
- * Adds a SOM name to the search node chain.
- *
- * @param inverseSearch the start point
- * @param stack the stack with the separated SOM parts
- * @param unstack the full name
- * @deprecated use {@link #addSomNameToSearchNodeChain}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public static void inverseSearchAdd(HashMap inverseSearch, Stack2 stack, String unstack) {
- addSomNameToSearchNodeChain(inverseSearch, stack, unstack);
- }
-
/**
* Adds a SOM name to the search node chain.
*
@@ -839,19 +825,6 @@ public void inverseSearchAdd(String unstack) {
addSomNameToSearchNodeChain(inverseSearch, stack, unstack);
}
- /**
- * Searches the SOM hierarchy from the bottom.
- *
- * @param parts the SOM parts
- * @return the full name or null if not found
- * @deprecated use {@link #inverseSearch(List)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public String inverseSearchGlobal(ArrayList parts) {
- return inverseSearch(parts);
- }
-
/**
* Searches the SOM hierarchy from the bottom.
*
@@ -880,29 +853,6 @@ public String inverseSearch(List parts) {
return store.getDefaultName();
}
- /**
- * Gets the order the names appear in the XML, depth first.
- *
- * @return the order the names appear in the XML, depth first
- * @deprecated use {@link #getNamesOrder()}
- */
- @Deprecated
- public ArrayList getOrder() {
- return (ArrayList) order;
- }
-
- /**
- * Sets the order the names appear in the XML, depth first
- *
- * @param order the order the names appear in the XML, depth first
- * @deprecated use {@link #setNamesOrder(List)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setOrder(ArrayList order) {
- this.order = order;
- }
-
/**
* Gets the order the names appear in the XML, depth first.
*
@@ -921,29 +871,6 @@ public void setNamesOrder(List order) {
this.order = order;
}
- /**
- * Gets the mapping of full names to nodes.
- *
- * @return the mapping of full names to nodes
- * @deprecated use {@link #getNodesByName()}
- */
- @Deprecated
- public HashMap getName2Node() {
- return (HashMap) name2Node;
- }
-
- /**
- * Sets the mapping of full names to nodes.
- *
- * @param name2Node the mapping of full names to nodes
- * @deprecated use {@link #setNodesByName(Map)}
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setName2Node(HashMap name2Node) {
- this.name2Node = name2Node;
- }
-
/**
* Gets the mapping of full names to nodes.
*
@@ -962,28 +889,6 @@ public void setNodesByName(Map name2Node) {
this.name2Node = name2Node;
}
- /**
- * Gets the data to do a search from the bottom hierarchy.
- *
- * @return the data to do a search from the bottom hierarchy
- * @deprecated use {@link #getInverseSearchData()}
- */
- @Deprecated
- public HashMap getInverseSearch() {
- return (HashMap) inverseSearch;
- }
-
- /**
- * Sets the data to do a search from the bottom hierarchy.
- *
- * @param inverseSearch the data to do a search from the bottom hierarchy
- * @deprecated use {@link #setInverseSearchData(Map)}
- */
- @Deprecated
- public void setInverseSearch(Map inverseSearch) {
- this.inverseSearch = inverseSearch;
- }
-
/**
* Gets the data to do a search from the bottom hierarchy.
*
@@ -1143,27 +1048,6 @@ public AcroFieldsSearch(Collection items) {
}
}
- /**
- * Gets the mapping from short names to long names. A long name may contain the #subform name part.
- *
- * @return the mapping from short names to long names
- */
- @Deprecated
- public HashMap getAcroShort2LongName() {
- return (HashMap) acroShort2LongName;
- }
-
- /**
- * Sets the mapping from short names to long names. A long name may contain the #subform name part.
- *
- * @param acroShort2LongName the mapping from short names to long names
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public void setAcroShort2LongName(HashMap acroShort2LongName) {
- this.acroShort2LongName = acroShort2LongName;
- }
-
/**
* Gets the mapping from short names to long names. A long name may contain the #subform name part.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/XfdfReader.java b/openpdf/src/main/java/com/lowagie/text/pdf/XfdfReader.java
index 13a7a2b64..a1fe436bb 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/XfdfReader.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/XfdfReader.java
@@ -106,20 +106,6 @@ public XfdfReader(byte[] xfdfIn) throws IOException {
SimpleXMLParser.parse(this, new ByteArrayInputStream(xfdfIn));
}
- /**
- * Gets all the fields. The map is keyed by the fully qualified field name and the value is a merged
- * PdfDictionary with the
- * field content.
- *
- * @return all the fields
- * @deprecated use {@link #getAllFields()}
- */
- @Override
- @Deprecated
- public HashMap getFields() {
- return (HashMap) fields;
- }
-
@Override
public Map getAllFields() {
return fields;
@@ -167,19 +153,6 @@ public String getFileSpec() {
return fileSpec;
}
- /**
- * Called when a start tag is found.
- *
- * @param tag the tag name
- * @param h the tag's attributes
- */
- @Deprecated
- @Override
- @SuppressWarnings("unchecked")
- public void startElement(String tag, HashMap h) {
- startElement(tag, (Map) h);
- }
-
/**
* Called when a start tag is found.
*
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenator.java b/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenator.java
index c5eb353da..f17504f1d 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenator.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenator.java
@@ -117,7 +117,6 @@ private static InputStream readHyphenationFile(String key) {
return stream;
}
-
/**
* @param key The language to get the tree from
* @return a hyphenation tree or null
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java b/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java
index d483c9469..dac2d128e 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java
@@ -58,7 +58,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -118,19 +117,19 @@ protected static String getInterletterValues(String pat) {
}
public static void main(String[] args) {
- try (FileInputStream fis = new FileInputStream(args[0]);) {
- if (args.length > 0) {
+ if (args.length > 0) {
+ try (FileInputStream fis = new FileInputStream(args[0])) {
SimplePatternParser pp = new SimplePatternParser();
pp.parse(fis, pp);
+ } catch (Exception e) {
+ e.printStackTrace();
}
- } catch (Exception e) {
- e.printStackTrace();
}
}
public void parse(InputStream stream, PatternConsumer consumer) {
this.consumer = consumer;
- try {
+ try (stream) {
SimpleXMLParser.parse(this, stream);
} catch (IOException e) {
throw new ExceptionConverter(e);
@@ -222,16 +221,6 @@ public void endElement(String tag) {
public void startDocument() {
}
- /**
- * @deprecated use {@link SimplePatternParser#startElement(String, Map)}
- */
- @Override
- @Deprecated
- @SuppressWarnings("unchecked")
- public void startElement(String tag, HashMap h) {
- startElement(tag, ((Map) h));
- }
-
@Override
public void startElement(String tag, Map h) {
switch (tag) {
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/parser/ParsedText.java b/openpdf/src/main/java/com/lowagie/text/pdf/parser/ParsedText.java
index 539ecb7d9..3cd1c1c57 100644
--- a/openpdf/src/main/java/com/lowagie/text/pdf/parser/ParsedText.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/parser/ParsedText.java
@@ -67,22 +67,6 @@ public class ParsedText extends ParsedTextImpl {
*/
private PdfString pdfText = null;
- /**
- * This constructor should only be called when the origin for text display is at (0,0) and the graphical state
- * reflects all transformations of the baseline. This is in text space units.
- *
- * Decodes a String (which will contain glyph ids encoded in the font's encoding) based on the active font. This is
- * supported for compatibility, but is no longer preferred.
- *
- * @param text string
- * @param graphicsState graphical state
- * @param textMatrix transform from text space to graphics (drawing space)
- */
- @Deprecated
- ParsedText(String text, GraphicsState graphicsState, Matrix textMatrix) {
- this(text, new GraphicsState(graphicsState), textMatrix.multiply(graphicsState.getCtm()),
- getUnscaledFontSpaceWidth(graphicsState));
- }
/**
* This constructor should only be called when the origin for text display is at (0,0) and the graphical state
@@ -132,25 +116,6 @@ private ParsedText(PdfString text, GraphicsState graphicsState, Matrix textMatri
this.graphicsState = graphicsState;
}
- /**
- * Internal constructor when the code points are already in a string.
- *
- * @param text string
- * @param graphicsState graphical state
- * @param textMatrix transform from text space to graphics (drawing space)
- * @param unscaledWidth width of the space character in the font.
- */
- @Deprecated
- private ParsedText(String text, GraphicsState graphicsState, Matrix textMatrix, float unscaledWidth) {
- super(text, pointToUserSpace(0, 0, textMatrix),
- pointToUserSpace(getStringWidth(text, graphicsState), 0f, textMatrix),
- pointToUserSpace(1.0f, 0f, textMatrix),
- convertHeightToUser(graphicsState.getFontAscentDescriptor(), textMatrix),
- convertHeightToUser(graphicsState.getFontDescentDescriptor(), textMatrix),
- convertWidthToUser(unscaledWidth, textMatrix));
- textToUserSpaceTransformMatrix = textMatrix;
- this.graphicsState = graphicsState;
- }
/**
* @param xOffset offset in x direction
diff --git a/openpdf/src/main/java/com/lowagie/text/xml/TagMap.java b/openpdf/src/main/java/com/lowagie/text/xml/TagMap.java
index b5f711105..719647204 100644
--- a/openpdf/src/main/java/com/lowagie/text/xml/TagMap.java
+++ b/openpdf/src/main/java/com/lowagie/text/xml/TagMap.java
@@ -150,19 +150,6 @@ class AttributeHandler extends DefaultHandler {
*/
private XmlPeer currentPeer;
- /**
- * Constructs a new SAXiTextHandler that will translate all the events triggered by the parser to actions on
- * the
- * Document-object.
- *
- * @param tagMap A Hashmap containing XmlPeer-objects
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public AttributeHandler(HashMap tagMap) {
- this.tagMap = tagMap;
- }
-
public AttributeHandler(Map tagMap) {
this.tagMap = tagMap;
}
diff --git a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToSymbol.java b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToSymbol.java
index 290bf8f70..9b139b05a 100644
--- a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToSymbol.java
+++ b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToSymbol.java
@@ -64,11 +64,8 @@ public class EntitiesToSymbol {
/**
* This is a map that contains all possible id values of the entity tag that can be translated to a character in
* font Symbol.
- *
- * @deprecated use the getter ({@link EntitiesToSymbol#getMap()}) instead of accessing this field directly
*/
- @Deprecated
- public static final HashMap map;
+ static final HashMap map;
static {
map = new HashMap<>(300);
diff --git a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToUnicode.java b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToUnicode.java
index f3619d1c9..b0b508d13 100644
--- a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToUnicode.java
+++ b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/EntitiesToUnicode.java
@@ -61,11 +61,8 @@ public class EntitiesToUnicode {
/**
* This is a map that contains the names of entities and their unicode value.
- *
- * @deprecated use the getter ({@link EntitiesToUnicode#getMap()}) instead of accessing this field directly
*/
- @Deprecated
- public static final HashMap map = new HashMap<>();
+ static final HashMap map = new HashMap<>();
static {
map.put("nbsp", '\u00a0'); // no-break space = non-breaking space, U+00A0 ISOnum
diff --git a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLDocHandler.java b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLDocHandler.java
index e0d8a2eda..679a2f17f 100644
--- a/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLDocHandler.java
+++ b/openpdf/src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLDocHandler.java
@@ -46,7 +46,6 @@
*/
package com.lowagie.text.xml.simpleparser;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -56,14 +55,6 @@
*/
public interface SimpleXMLDocHandler {
- /**
- * Called when a start tag is found.
- *
- * @param tag the tag name
- * @param h the tag's attributes
- */
- void startElement(String tag, HashMap h);
-
/**
* Called when a start tag is found.
*
diff --git a/openpdf/src/main/resources/font-fallback/README.md b/openpdf/src/main/resources/font-fallback/README.md
index 462d31b6d..338a71e94 100644
--- a/openpdf/src/main/resources/font-fallback/README.md
+++ b/openpdf/src/main/resources/font-fallback/README.md
@@ -2,4 +2,4 @@
This is only a fallback font for existing OpenPDF code. For using the full set of Liberation Fonts,
please add the openpdf-fonts-extra dependency to you project and use the class
-`org.librepdf.openpdf.fonts.Liberation`.
+`org.librepdf.openpdf.fonts.Liberation`.
\ No newline at end of file
diff --git a/openpdf/src/test/java/com/lowagie/text/ImageTest.java b/openpdf/src/test/java/com/lowagie/text/ImageTest.java
index b0d01ce6d..0139b3611 100644
--- a/openpdf/src/test/java/com/lowagie/text/ImageTest.java
+++ b/openpdf/src/test/java/com/lowagie/text/ImageTest.java
@@ -5,9 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.io.InputStream;
import org.junit.jupiter.api.Test;
class ImageTest {
@@ -86,9 +84,13 @@ void performanceTestGifWithFilename() throws IOException {
}
private byte[] readFileBytes() throws IOException {
- String name = "src/test/resources/imageTest/ImageTest.png";
- Path path = Paths.get(name);
- return Files.readAllBytes(path);
+ byte[] bytes = null;
+ try (InputStream stream = this.getClass().getResourceAsStream("/imageTest/ImageTest.png")) {
+ if (stream != null) {
+ bytes = stream.readAllBytes();
+ }
+ }
+ return bytes;
}
}
diff --git a/openpdf/src/test/java/com/lowagie/text/pdf/FontDetailsTest.java b/openpdf/src/test/java/com/lowagie/text/pdf/FontDetailsTest.java
index 579b35756..83e4eefff 100644
--- a/openpdf/src/test/java/com/lowagie/text/pdf/FontDetailsTest.java
+++ b/openpdf/src/test/java/com/lowagie/text/pdf/FontDetailsTest.java
@@ -25,4 +25,5 @@ void convertToBytesShouldExerciseSomeCode() throws IOException {
assertThat(bytes).hasSize(22);
assertThat(fontDetails.isSubset()).isTrue();
}
+
}
diff --git a/openpdf/src/test/java/com/lowagie/text/pdf/PdfDocumentCJKExtensionTest.java b/openpdf/src/test/java/com/lowagie/text/pdf/PdfDocumentCJKExtensionTest.java
deleted file mode 100644
index 3179abbad..000000000
--- a/openpdf/src/test/java/com/lowagie/text/pdf/PdfDocumentCJKExtensionTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.lowagie.text.pdf;
-
-import static org.assertj.core.api.Assertions.assertThatNoException;
-
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.FontFactory;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-class PdfDocumentCJKExtensionTest {
-
- // This test is here only for documentation purposes.
- @Disabled("This test requires a specific font file, which is very large. It is not included in the repository.")
- @Test
- void generateDocumentsWithCJKExtension() throws IOException {
- String fontName = "TakaoMjMincho";
-
- // TakaoMjMincho Version 003.01.01
- // Please download and place it below.
- // https://launchpad.net/takao-fonts
- // https://launchpad.net/takao-fonts/trunk/15.03/+download/TakaoMjFonts_00301.01.zip
- String fontPath = "src/test/resources/fonts/TakaoMjFonts/TakaoMjMincho.ttf";
-
- // register font
- assertThatNoException().as("You need to download the font file and place it in the correct place.")
- .isThrownBy(() -> FontFactory.register(fontPath, fontName));
-
- Document document = new Document();
-
- // FOP off
- document.setGlyphSubstitutionEnabled(false);
-
- PdfWriter.getInstance(document,
- Files.newOutputStream(
- Paths.get("target/" + PdfDocumentCJKExtensionTest.class.getSimpleName() + ".pdf")));
-
- try {
- Font font = FontFactory.getFont(fontName, "Identity-H", false, 10, 0, null);
-
- document.open();
- // CJK Unified Ideographs Extension B
- // https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_B
-
- // U+20000
- String cjkB_OK = "𠀀";
- // U+2A000
- String cjkB_NG = "𪀀";
-
- // CJK Unified Ideographs Extension C
- // https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_C
-
- // U+2A746
- String cjkC_NG = "𪝆";
-
- // CJK Unified Ideographs Extension D
- // https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_D
-
- // U+2B746
- String cjkD_NG = "𫝆";
-
- document.add(new Chunk(cjkB_OK + " " + cjkB_NG + " " + cjkC_NG + " " + cjkD_NG, font));
-
- } finally {
- document.close();
- }
- }
-}
diff --git a/openpdf/src/test/java/com/lowagie/text/pdf/fonts/FontTest.java b/openpdf/src/test/java/com/lowagie/text/pdf/fonts/FontTest.java
index f2704dc77..71ad88053 100644
--- a/openpdf/src/test/java/com/lowagie/text/pdf/fonts/FontTest.java
+++ b/openpdf/src/test/java/com/lowagie/text/pdf/fonts/FontTest.java
@@ -36,7 +36,7 @@
*/
class FontTest {
- private static final Map> STYLES_TO_TEST_METHOD = new HashMap>() {
+ private static final Map> STYLES_TO_TEST_METHOD = new HashMap<>() {
{
put(Font.NORMAL, f -> !f.isBold() && !f.isItalic() && !f.isStrikethru() && !f.isUnderlined());
put(Font.BOLD, Font::isBold);
diff --git a/openpdf/src/test/java/com/lowagie/text/xml/simpleparser/SimpleXMLParserTest.java b/openpdf/src/test/java/com/lowagie/text/xml/simpleparser/SimpleXMLParserTest.java
index 193db8b34..3f91e512b 100755
--- a/openpdf/src/test/java/com/lowagie/text/xml/simpleparser/SimpleXMLParserTest.java
+++ b/openpdf/src/test/java/com/lowagie/text/xml/simpleparser/SimpleXMLParserTest.java
@@ -4,7 +4,6 @@
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -57,11 +56,6 @@ static class TestHandler implements SimpleXMLDocHandler, AutoCloseable {
this.charset = charset.displayName();
}
- @Override
- public void startElement(String tag, HashMap h) {
- // should do nothing
- }
-
@Override
public void startElement(String tag, Map h) {
}
diff --git a/pdf-swing/pom.xml b/pdf-swing/pom.xml
index f30d3a0fd..c05345eff 100644
--- a/pdf-swing/pom.xml
+++ b/pdf-swing/pom.xml
@@ -1,33 +1,34 @@
-
- 4.0.0
+
+ 4.0.0
-
- com.github.librepdf
- openpdf-parent
- 1.3.43.jaspersoft.2
-
+
+ com.github.librepdf
+ openpdf-parent
+ 1.4.2.jaspersoft.1-SNAPSHOT
+
- pdf-swing
+ pdf-swing
-
- com.github.librepdf.pdfSwing
-
+
+ com.github.librepdf.pdfSwing
+
-
-
- com.github.librepdf
- openpdf
- ${project.version}
-
-
- org.swinglabs
- pdf-renderer
-
-
- org.dom4j
- dom4j
-
-
+
+
+ com.github.librepdf
+ openpdf
+ ${project.version}
+
+
+ org.swinglabs
+ pdf-renderer
+
+
+ org.dom4j
+ dom4j
+
+
diff --git a/pdf-toolbox/pom.xml b/pdf-toolbox/pom.xml
index 7a146b6cc..b1d70b2cf 100644
--- a/pdf-toolbox/pom.xml
+++ b/pdf-toolbox/pom.xml
@@ -1,50 +1,51 @@
-
- 4.0.0
+
+ 4.0.0
-
- com.github.librepdf
- openpdf-parent
- 1.3.43.jaspersoft.2
-
+
+ com.github.librepdf
+ openpdf-parent
+ 1.4.2.jaspersoft.1-SNAPSHOT
+
- pdf-toolbox
+ pdf-toolbox
-
- com.github.librepdf.pdfToolbox
-
+
+ com.github.librepdf.pdfToolbox
+
-
-
- com.github.librepdf
- openpdf
- ${project.version}
-
-
- org.jfree
- jfreechart
-
-
- org.jfree
- jcommon
-
+
+
+ com.github.librepdf
+ openpdf
+ ${project.version}
+
+
+ org.jfree
+ jfreechart
+
+
+ org.jfree
+ jcommon
+
-
-
- jakarta.servlet
- jakarta.servlet-api
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- test
-
-
- org.assertj
- assertj-core
- test
-
-
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.assertj
+ assertj-core
+ test
+
+
diff --git a/pom.xml b/pom.xml
index dcbf5d873..66c932efb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.librepdf
openpdf-parent
- 1.3.43.jaspersoft.2
+ 1.4.2.jaspersoft.1-SNAPSHOT
pom
@@ -61,7 +61,7 @@
com.github.librepdf.openpdf.parent
- 8
+ 11
UTF-8
UTF-8
@@ -89,17 +89,14 @@
2.15.1
2.1.4
2.9
-
- 5.0.0
+ 6.0.0
1.0.24
1.5.4
1.0.5
3.25.3
-
- 9.3
+ 10.14.0
2.2
0.8.11
5.10.2
@@ -241,14 +238,13 @@
-
+
org.apache.maven.plugins
maven-compiler-plugin
${maven.compiler.plugin.version}
- ${java.version}
- ${java.version}
+ ${java.version}
-Xlint:unchecked
@@ -311,10 +307,6 @@
true
-
-
- com.lowagie.*;version="${project.version}"
-
@@ -401,57 +393,9 @@
- jdk8
+ jdk11-plus
- (,8]
- true
-
-
-
-
- org.mockito
- mockito-core
- ${mockito4.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven.compiler.plugin.version}
-
-
- compile-java-8
-
- compile
-
-
- 1.8
- 1.8
- ${project.build.sourceEncoding}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 3.2.2
-
- -Dfile.encoding=UTF-8
-
-
-
-
-
-
-
- jdk9-plus
-
- [8,)
+ [11,)
@@ -469,17 +413,18 @@
maven-compiler-plugin
${maven.compiler.plugin.version}
- 8
+ 11
- compile-java-8
+ compile-java-11
compile
- 8
+ 11
+ ${project.basedir}/src/main/java
true