diff --git a/README.md b/README.md index 4c2958640..d1885b9c6 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,13 @@ OpenPDF is a Java library for creating and editing PDF files with a LGPL and MPL open source license. OpenPDF is based on a fork of iText 4. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository. -[![Join the chat at https://gitter.im/LibrePDF/OpenPDF](https://badges.gitter.im/LibrePDF/OpenPDF.svg)](https://gitter.im/LibrePDF/OpenPDF) [![Build Status](https://api.travis-ci.org/LibrePDF/OpenPDF.png)](https://travis-ci.org/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) +[![Join the chat at https://gitter.im/LibrePDF/OpenPDF](https://badges.gitter.im/LibrePDF/OpenPDF.svg)](https://gitter.im/LibrePDF/OpenPDF) [![Build Status](https://travis-ci.org/LibrePDF/OpenPDF.svg?branch=master)](https://travis-ci.org/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.0.4 released 2017-10-11 ## -Get version 1.0.4 here - https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.4 +## OpenPDF version 1.0.5 released 2017-11-16 ## +Get version 1.0.5 here - https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.5 ### Previous Versions +- [Version 1.0.4](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.4) _released 2017-10-11_ - [Version 1.0.3](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.3) _released 2017-07-24_ - [Version 1.0.2](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.2) _released 2017-06-03_ - [Version 1.0.1](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.1) _released 2017-01-28_ @@ -26,7 +27,7 @@ Add this to your pom.xml file: com.github.librepdf openpdf - 1.0.4 + 1.0.5 @@ -52,7 +53,7 @@ Release the hounds! Please send all pull requests. ### Required: ### - - BouncyCastle 1.57 + - BouncyCastle 1.58 - Provider - PKIX/CMS - PDFRenderer diff --git a/openpdf/pom.xml b/openpdf/pom.xml index 74e9d0ffc..111c2c219 100644 --- a/openpdf/pom.xml +++ b/openpdf/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT openpdf 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 006b52d52..5cbd2af1a 100644 --- a/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java +++ b/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java @@ -53,9 +53,9 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.StringReader; import java.util.ArrayList; import java.util.Collection; import java.util.EmptyStackException; @@ -67,9 +67,9 @@ import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -148,6 +148,12 @@ else if (xfa instanceof PRStream) { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); fact.setNamespaceAware(true); DocumentBuilder db = fact.newDocumentBuilder(); + db.setEntityResolver(new EntityResolver() { + @Override + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + return new InputSource(new StringReader("")); + } + }); domDocument = db.parse(new ByteArrayInputStream(bout.toByteArray())); extractNodes(); } @@ -1119,7 +1125,13 @@ public void fillXfaForm(InputStream is) throws ParserConfigurationException, SAX public void fillXfaForm(InputSource is) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); + DocumentBuilder db = dbf.newDocumentBuilder(); + db.setEntityResolver(new EntityResolver() { + @Override + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + return new InputSource(new StringReader("")); + } + }); Document newdoc = db.parse(is); fillXfaForm(newdoc.getDocumentElement()); } diff --git a/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java b/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java index fe812be29..7d1dccba4 100644 --- a/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java +++ b/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java @@ -49,6 +49,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -58,6 +59,8 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; import com.lowagie.text.ExceptionConverter; @@ -85,6 +88,12 @@ public XmpReader(byte[] bytes) throws SAXException, IOException { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); fact.setNamespaceAware(true); DocumentBuilder db = fact.newDocumentBuilder(); + db.setEntityResolver(new EntityResolver() { + @Override + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + return new InputSource(new StringReader("")); + } + }); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); domDocument = db.parse(bais); } catch (ParserConfigurationException e) { diff --git a/pdf-html/pom.xml b/pdf-html/pom.xml index 9e57e3522..bb00f5918 100644 --- a/pdf-html/pom.xml +++ b/pdf-html/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT pdf-html diff --git a/pdf-rtf/pom.xml b/pdf-rtf/pom.xml index 0c458e777..0b9df6c90 100644 --- a/pdf-rtf/pom.xml +++ b/pdf-rtf/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT pdf-rtf diff --git a/pdf-swing/pom.xml b/pdf-swing/pom.xml index c751ef542..61b3a6335 100644 --- a/pdf-swing/pom.xml +++ b/pdf-swing/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT pdf-swing diff --git a/pdf-toolbox/pom.xml b/pdf-toolbox/pom.xml index 3436c46f4..6a0ba09c0 100644 --- a/pdf-toolbox/pom.xml +++ b/pdf-toolbox/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT pdf-toolbox diff --git a/pdf-toolbox/src/main/java/com/lowagie/tools/BuildTutorial.java b/pdf-toolbox/src/main/java/com/lowagie/tools/BuildTutorial.java index a4ccb7e56..fc523ba56 100644 --- a/pdf-toolbox/src/main/java/com/lowagie/tools/BuildTutorial.java +++ b/pdf-toolbox/src/main/java/com/lowagie/tools/BuildTutorial.java @@ -54,6 +54,7 @@ import java.io.FileWriter; import java.io.IOException; +import javax.xml.XMLConstants; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; @@ -171,7 +172,7 @@ public static void convert(File infile, File xslfile, File outfile) { try { // Create transformer factory TransformerFactory factory = TransformerFactory.newInstance(); - + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); // Use the factory to create a template containing the xsl file Templates template = factory.newTemplates(new StreamSource( new FileInputStream(xslfile))); diff --git a/pdf-xml/pom.xml b/pdf-xml/pom.xml index d255101fe..53577884e 100644 --- a/pdf-xml/pom.xml +++ b/pdf-xml/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT pdf-xml diff --git a/pom.xml b/pom.xml index 8f4f81806..5a2ec0f95 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.librepdf openpdf-parent pom - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT