Skip to content

Commit

Permalink
Merge pull request #1 from LibrePDF/master
Browse files Browse the repository at this point in the history
Pull request
  • Loading branch information
V-F authored Jul 23, 2019
2 parents 46e86ed + 91a32d7 commit 73db305
Show file tree
Hide file tree
Showing 59 changed files with 671 additions and 464 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,5 @@ buildNumber.properties
### Custom
*.rtf
*.html

*.pdf
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ OpenPDF is a Java library for creating and editing PDF files with a LGPL and MPL

[![Build Status](https://travis-ci.org/LibrePDF/OpenPDF.svg?branch=master)](https://travis-ci.org/LibrePDF/OpenPDF) [![Join the chat at https://gitter.im/LibrePDF/OpenPDF](https://badges.gitter.im/LibrePDF/OpenPDF.svg)](https://gitter.im/LibrePDF/OpenPDF) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.librepdf/openpdf/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.librepdf/openpdf) [![License (LGPL version 3.0)](https://img.shields.io/badge/license-GNU%20LGPL%20version%203.0-blue.svg?style=flat-square)](http://opensource.org/licenses/LGPL-3.0) [![License (MPL)](https://img.shields.io/badge/license-Mozilla%20Public%20License-yellow.svg?style=flat-square)](http://opensource.org/licenses/MPL-2.0)

## OpenPDF version 1.2.20 released 2019-06-13 ##
Get version 1.2.20 here - https://github.com/LibrePDF/OpenPDF/releases/tag/1.2.20
## OpenPDF version 1.2.21 released 2019-06-24 ##
Get version 1.2.21 here - https://github.com/LibrePDF/OpenPDF/releases/tag/1.2.21

- [Previous releases](https://github.com/LibrePDF/OpenPDF/releases)

Expand All @@ -16,7 +16,7 @@ Add this to your pom.xml file to use the latest version of OpenPDF:
<dependency>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf</artifactId>
<version>1.2.20</version>
<version>1.2.21</version>
</dependency>

## License ##
Expand Down Expand Up @@ -93,7 +93,8 @@ Significant [Contributors to OpenPDF](https://github.com/LibrePDF/OpenPDF/graphs
[@MartinKocour](https://github.com/MartinKocour)
[@jokimaki](https://github.com/jokimaki)
[@sullis](https://github.com/sullis)
[@lapo-luchini](https://github.com/lapo-luchini)
[@jeffrey-easyesi](https://github.com/jeffrey-easyesi)
[@lapo-luchini](https://github.com/lapo-luchini)
[@jeffrey-easyesi](https://github.com/jeffrey-easyesi)
[@V-F](https://github.com/V-F)

Also, a very special thanks to the iText developers ;)
2 changes: 1 addition & 1 deletion openpdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf-parent</artifactId>
<version>1.2.21-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>

<artifactId>openpdf</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public class BouncyCastleHelper {
public static void checkCertificateEncodingOrThrowException(Certificate certificate) {
// OJO...
try {
X509CertificateHolder certificateHolder = new X509CertificateHolder(certificate.getEncoded());
new X509CertificateHolder(certificate.getEncoded());
} catch (CertificateEncodingException | IOException f) {
throw new ExceptionConverter(f);
}
// ******************************************************************************
}

@SuppressWarnings("unchecked")
public static byte[] getEnvelopedData(PdfArray recipients, List<PdfObject> strings, Certificate certificate, Key certificateKey, String certificateKeyProvider) {
byte[] envelopedData = null;
for (PdfObject recipient : recipients.getElements()) {
Expand Down
8 changes: 4 additions & 4 deletions openpdf/src/main/java/com/lowagie/text/Anchor.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ public boolean process(ElementListener listener) {
*
* @return an <CODE>ArrayList</CODE>
*/
public ArrayList getChunks() {
ArrayList<Chunk> tmp = new ArrayList<>();
public java.util.List<Element> getChunks() {
java.util.List<Element> tmp = new ArrayList<>();
Chunk chunk;
Iterator<Chunk> i = iterator();
Iterator<Element> i = iterator();
boolean localDestination = (reference != null && reference.startsWith("#"));
boolean notGotoOK = true;
while (i.hasNext()) {
chunk = i.next();
chunk = (Chunk) i.next();
if (name != null && notGotoOK && !chunk.isEmpty()) {
chunk.setLocalDestination(name);
notGotoOK = false;
Expand Down
24 changes: 12 additions & 12 deletions openpdf/src/main/java/com/lowagie/text/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@
* @see Row
*/

public class Cell extends Rectangle implements TextElementArray, WithHorizontalAlignment, WithVerticalAlignment {
public class Cell extends TableRectangle implements TextElementArray, WithHorizontalAlignment, WithVerticalAlignment {

// membervariables

/**
* The <CODE>ArrayList</CODE> of <CODE>Element</CODE>s
* that are part of the content of the Cell.
*/
protected ArrayList arrayList = null;
protected java.util.List<Element> arrayList = null;

/** The horizontal alignment of the cell content. */
protected int horizontalAlignment = Element.ALIGN_UNDEFINED;
Expand Down Expand Up @@ -178,7 +178,7 @@ public Cell() {
setBorder(UNDEFINED);
setBorderWidth(0.5f);
// initializes the arraylist
arrayList = new ArrayList();
arrayList = new ArrayList<>();
}

/**
Expand Down Expand Up @@ -253,10 +253,10 @@ public int type() {
*
* @return an <CODE>ArrayList</CODE>
*/
public ArrayList getChunks() {
ArrayList tmp = new ArrayList();
for (Object o : arrayList) {
tmp.addAll(((Element) o).getChunks());
public java.util.List<Element> getChunks() {
java.util.List<Element> tmp = new ArrayList<>();
for (Element o : arrayList) {
tmp.addAll(o.getChunks());
}
return tmp;
}
Expand Down Expand Up @@ -572,7 +572,7 @@ public boolean isEmpty() {
case 0:
return true;
case 1:
Element element = (Element) arrayList.get(0);
Element element = arrayList.get(0);
switch (element.type()) {
case Element.CHUNK:
return ((Chunk) element).isEmpty();
Expand Down Expand Up @@ -605,7 +605,7 @@ void fill() {
*/
public boolean isTable() {
return (size() == 1)
&& (((Element)arrayList.get(0)).type() == Element.TABLE);
&& (arrayList.get(0).type() == Element.TABLE);
}

/**
Expand Down Expand Up @@ -679,7 +679,7 @@ public void addElement(Element element) throws BadElementException {
tmp = new Cell();
tmp.setBorder(NO_BORDER);
tmp.setColspan(3);
for (Object o : arrayList) {
for (Element o : arrayList) {
tmp.add(o);
}
table.addCell(tmp);
Expand All @@ -706,9 +706,9 @@ public void addElement(Element element) throws BadElementException {
* @param o the object to add
* @return always <CODE>true</CODE>
*/
public boolean add(Object o) {
public boolean add(Element o) {
try {
this.addElement((Element) o);
this.addElement(o);
return true;
}
catch(ClassCastException cce) {
Expand Down
3 changes: 3 additions & 0 deletions openpdf/src/main/java/com/lowagie/text/DocWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ public void setPageCount(int pageN) {
*/

public void close() {
if (!open) {
return;
}
open = false;
try {
os.flush();
Expand Down
4 changes: 1 addition & 3 deletions openpdf/src/main/java/com/lowagie/text/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

package com.lowagie.text;

import java.util.ArrayList;

/**
* Interface for a text element.
* <P>
Expand Down Expand Up @@ -346,7 +344,7 @@ public interface Element {
* @return an <CODE>ArrayList</CODE>
*/

ArrayList getChunks();
java.util.List<Element> getChunks();

/**
* Gets the content of the text element.
Expand Down
37 changes: 19 additions & 18 deletions openpdf/src/main/java/com/lowagie/text/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class List implements TextElementArray {
// member variables

/** This is the <CODE>ArrayList</CODE> containing the different <CODE>ListItem</CODE>s. */
protected ArrayList list = new ArrayList();
protected java.util.List<Element> list = new ArrayList<>();

/** Indicates if the list has to be numbered. */
protected boolean numbered = false;
Expand Down Expand Up @@ -250,10 +250,10 @@ public int type() {
*
* @return an <CODE>ArrayList</CODE>
*/
public ArrayList getChunks() {
ArrayList tmp = new ArrayList();
for (Object o : list) {
tmp.addAll(((Element) o).getChunks());
public java.util.List<Element> getChunks() {
java.util.List<Element> tmp = new ArrayList<>();
for (Element o : list) {
tmp.addAll(o.getChunks());
}
return tmp;
}
Expand All @@ -266,7 +266,7 @@ public ArrayList getChunks() {
* @param o the object to add.
* @return true if adding the object succeeded
*/
public boolean add(Object o) {
public boolean add(Element o) {
if (o instanceof ListItem) {
ListItem item = (ListItem) o;
if (numbered || lettered) {
Expand All @@ -286,19 +286,20 @@ public boolean add(Object o) {
item.setIndentationRight(0);
return list.add(item);
}
else if (o instanceof List) {
List nested = (List) o;
nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent);
first--;
return list.add(nested);
}
else if (o instanceof String) {
return this.add(new ListItem((String) o));
}
return false;
}

// extra methods

public boolean add(List nested) {
nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent);
first--;
return list.add(nested);
}

public boolean add(String o) {
return this.add(new ListItem(o));
}

// extra methods

/** Makes sure all the items in the list have the same indentation. */
public void normalizeIndentation() {
Expand Down Expand Up @@ -415,7 +416,7 @@ public void setSymbolIndent(float symbolIndent) {
*
* @return an <CODE>ArrayList</CODE> containing <CODE>ListItem</CODE>s.
*/
public ArrayList getItems() {
public java.util.List<Element> getItems() {
return list;
}

Expand Down
3 changes: 1 addition & 2 deletions openpdf/src/main/java/com/lowagie/text/MarkedObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

package com.lowagie.text;

import java.util.ArrayList;
import java.util.Properties;

/**
Expand Down Expand Up @@ -87,7 +86,7 @@ public MarkedObject(Element element) {
*
* @return an <CODE>ArrayList</CODE>
*/
public ArrayList getChunks() {
public java.util.List<Element> getChunks() {
return element.getChunks();
}

Expand Down
6 changes: 3 additions & 3 deletions openpdf/src/main/java/com/lowagie/text/MarkedSection.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public MarkedSection(Section section) {
* @param o an object of type <CODE>Paragraph</CODE>, <CODE>List</CODE> or <CODE>Table</CODE>=
* @throws ClassCastException if the object is not a <CODE>Paragraph</CODE>, <CODE>List</CODE> or <CODE>Table</CODE>
*/
public void add(int index, Object o) {
public void add(int index, Element o) {
((Section)element).add(index, o);
}

Expand All @@ -97,7 +97,7 @@ public void add(int index, Object o) {
* @return a boolean
* @throws ClassCastException if the object is not a <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE> or <CODE>Section</CODE>
*/
public boolean add(Object o) {
public boolean add(Element o) {
return ((Section)element).add(o);
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public boolean process(ElementListener listener) {
* @return <CODE>true</CODE> if the action succeeded, <CODE>false</CODE> if not.
* @throws ClassCastException if one of the objects isn't a <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE>
*/
public boolean addAll(Collection collection) {
public boolean addAll(Collection<? extends Element> collection) {
return ((Section)element).addAll(collection);
}

Expand Down
2 changes: 1 addition & 1 deletion openpdf/src/main/java/com/lowagie/text/Paragraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public int type() {
* @param o object the object to add.
* @return true is adding the object succeeded
*/
public boolean add(Object o) {
public boolean add(Element o) {
if (o instanceof List) {
List list = (List) o;
list.setIndentationLeft(list.getIndentationLeft() + indentationLeft);
Expand Down
Loading

0 comments on commit 73db305

Please sign in to comment.