getClassNames()
{
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java 2016-12-05 19:30:18.000000000 +0000
@@ -209,7 +209,8 @@
/**
* Set if the user can print.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowPrinting A boolean determining if the user can print.
*/
@@ -233,7 +234,8 @@
/**
* Set if the user can modify the document.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowModifications A boolean determining if the user can modify the document.
*/
@@ -258,7 +260,8 @@
/**
* Set if the user can extract content from the document.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowExtraction A boolean determining if the user can extract content
* from the document.
@@ -272,7 +275,11 @@
}
/**
- * This will tell if the user can add/modify text annotations, fill in interactive forms fields.
+ * This will tell if the user can add or modify text annotations and fill in interactive forms
+ * fields and, if {@link #canModify() canModify()} returns true, create or modify interactive
+ * form fields (including signature fields). Note that if
+ * {@link #canFillInForm() canFillInForm()} returns true, it is still possible to fill in
+ * interactive forms (including signature fields) even if this method here returns false.
*
* @return true If supplied with the user password they are allowed to modify annotations.
*/
@@ -282,10 +289,15 @@
}
/**
- * Set if the user can modify annotations.
- * This method will have no effect if the object is in read only mode
+ * Set if the user can add or modify text annotations and fill in interactive forms fields and,
+ * if {@link #canModify() canModify()} returns true, create or modify interactive form fields
+ * (including signature fields). Note that if {@link #canFillInForm() canFillInForm()} returns
+ * true, it is still possible to fill in interactive forms (including signature fields) even the
+ * parameter here is false.
+ *
+ * This method will have no effect if the object is in read only mode.
*
- * @param allowAnnotationModification A boolean determining if the user can modify annotations.
+ * @param allowAnnotationModification A boolean determining the new setting.
*/
public void setCanModifyAnnotations( boolean allowAnnotationModification )
{
@@ -296,7 +308,8 @@
}
/**
- * This will tell if the user can fill in interactive forms.
+ * This will tell if the user can fill in interactive form fields (including signature fields)
+ * even if {@link #canModifyAnnotations() canModifyAnnotations()} returns false.
*
* @return true If supplied with the user password they are allowed to fill in form fields.
*/
@@ -306,8 +319,12 @@
}
/**
- * Set if the user can fill in interactive forms.
- * This method will have no effect if the object is in read only mode
+ * Set if the user can fill in interactive form fields (including signature fields) even if
+ * {@link #canModifyAnnotations() canModifyAnnotations()} returns false. Therefore, if you want
+ * to prevent a user from filling in interactive form fields, you need to call
+ * {@link #setCanModifyAnnotations(boolean) setCanModifyAnnotations(false)} as well.
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowFillingInForm A boolean determining if the user can fill in interactive forms.
*/
@@ -333,7 +350,8 @@
/**
* Set if the user can extract content from the document for accessibility purposes.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowExtraction A boolean determining if the user can extract content
* from the document.
@@ -359,7 +377,8 @@
/**
* Set if the user can insert/rotate/delete pages.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowAssembly A boolean determining if the user can assemble the document.
*/
@@ -384,7 +403,8 @@
/**
* Set if the user can print the document in a degraded format.
- * This method will have no effect if the object is in read only mode
+ *
+ * This method will have no effect if the object is in read only mode.
*
* @param allowAssembly A boolean determining if the user can print the
* document in a degraded format.
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java 2016-12-05 19:30:18.000000000 +0000
@@ -390,7 +390,17 @@
ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1"));
ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream);
DERObject derobject = asn1inputstream.readObject();
- KeyGenerator keygenerator = KeyGenerator.getInstance(s);
+ KeyGenerator keygenerator;
+ try
+ {
+ keygenerator = KeyGenerator.getInstance(s);
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ // happens when using the command line app .jar file
+ throw new NoSuchAlgorithmException("Could not find a suitable javax.crypto provider for algorithm " +
+ s + "; possible reason: using an unsigned .jar file", e);
+ }
keygenerator.init(128);
SecretKey secretkey = keygenerator.generateKey();
Cipher cipher = Cipher.getInstance(s);
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java 2016-12-05 19:30:18.000000000 +0000
@@ -236,6 +236,7 @@
if( isUserPassword )
{
currentAccessPermission = new AccessPermission( dicPermissions );
+ currentAccessPermission.setReadOnly();
encryptionKey =
computeEncryptedKey(
password.getBytes("ISO-8859-1"),
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java 2016-12-05 19:30:20.000000000 +0000
@@ -158,7 +158,7 @@
int arraySize = array.size();
for (int i=0; i 1)
+ {
+ LOG.warn("using 1 instead of incorrect Alpha " + alpha);
+ return 1;
+ }
+ return alpha;
}
}
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudShadingContext.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudShadingContext.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudShadingContext.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudShadingContext.java 2016-12-05 19:30:20.000000000 +0000
@@ -115,6 +115,16 @@
LOG.debug("color[" + n + "]: " + color + "/" + String.format("%02x", color)
+ "-> color[" + n + "]: " + colorComponentTab[n]);
}
+
+ // "Each set of vertex data shall occupy a whole number of bytes.
+ // If the total number of bits required is not divisible by 8, the last data byte
+ // for each vertex is padded at the end with extra bits, which shall be ignored."
+ int bitOffset = input.getBitOffset();
+ if (bitOffset != 0)
+ {
+ input.readBits(8 - bitOffset);
+ }
+
return new Vertex(tmp, colorComponentTab);
}
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java 2016-12-05 19:30:20.000000000 +0000
@@ -84,12 +84,13 @@
private final COSDictionary dictionary;
- /**
+ /**
* Create the correct annotation from the base COS object.
- *
+ *
* @param base The COS object that is the annotation.
* @return The correctly typed annotation object.
- * @throws IOException If there is an error while creating the annotation.
+ *
+ * @throws IOException If the annotation type is unknown.
*/
public static PDAnnotation createAnnotation(COSBase base) throws IOException
{
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java 2016-12-05 19:30:20.000000000 +0000
@@ -23,7 +23,9 @@
import org.apache.pdfbox.pdfparser.VisualSignatureParser;
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigProperties;
-
+/**
+ * This contains the visual signature as a COSDocument, its preferred size and the page.
+ */
public class SignatureOptions
{
private COSDocument visualSignature;
@@ -113,4 +115,17 @@
preferedSignatureSize = size;
}
}
+
+ /**
+ * Closes the visual signature COSDocument, if any.
+ *
+ * @throws IOException if the document could not be closed
+ */
+ public void close() throws IOException
+ {
+ if (visualSignature != null)
+ {
+ visualSignature.close();
+ }
+ }
}
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java 2016-12-05 19:30:20.000000000 +0000
@@ -68,7 +68,6 @@
* @param properties
* @return InputStream
* @throws IOException
- * @throws COSVisitorException
*/
public InputStream buildPDF(PDVisibleSignDesigner properties) throws IOException
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java 2016-12-05 19:30:20.000000000 +0000
@@ -19,6 +19,7 @@
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -64,7 +65,7 @@
public PDVisibleSignDesigner(InputStream originalDocumenStream, InputStream imageStream, int page) throws IOException
{
signatureImageStream(imageStream);
- document = PDDocument.load(originalDocumenStream);
+ document = PDDocument.loadNonSeq(originalDocumenStream, null);
calculatePageSize(document, page);
}
@@ -77,11 +78,11 @@
*/
public PDVisibleSignDesigner(String documentPath, InputStream imageStream, int page) throws IOException
{
- // set visible singature image Input stream
+ // set visible signature image Input stream
signatureImageStream(imageStream);
// create PD document
- document = PDDocument.load(documentPath);
+ document = PDDocument.loadNonSeq(new File(documentPath), null);
// calculate height an width of document
calculatePageSize(document, page);
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java 2016-12-05 19:30:18.000000000 +0000
@@ -1365,7 +1365,6 @@
{
writer = new COSWriter( output );
writer.write( this );
- writer.close();
}
finally
{
@@ -1411,7 +1410,6 @@
output.write("\r\n".getBytes("ISO-8859-1"));
writer = new COSWriter( output, input );
writer.write( this );
- writer.close();
}
finally
{
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java 2016-12-05 19:30:20.000000000 +0000
@@ -650,10 +650,11 @@
}
/**
- * This will get a list of PDThreadBead objects, which are article threads in the
- * document. This will return an empty list if there are no thread beads.
+ * This will get a list of PDThreadBead objects, which are article threads in the document. This
+ * will return an empty list if there are no thread beads.
*
- * @return A list of article threads on this page.
+ * @return A list of article threads on this page, never null. The returned list is backed by
+ * the beads COSArray, so any adding or deleting in this list will change the document too.
*/
public List getThreadBeads()
{
@@ -675,7 +676,6 @@
pdObjects.add( bead );
}
return new COSArrayList(pdObjects, beads);
-
}
/**
@@ -831,11 +831,12 @@
}
/**
- * This will return a list of the Annotations for this page.
- *
- * @return List of the PDAnnotation objects.
+ * This will return a list of the annotations for this page.
*
- * @throws IOException If there is an error while creating the annotations.
+ * @return List of the PDAnnotation objects, never null. The returned list is backed by the
+ * annotations COSArray, so any adding or deleting in this list will change the document too.
+ *
+ * @throws IOException If there is an error while creating the annotation list.
*/
public List getAnnotations() throws IOException
{
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/TextToPDF.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/TextToPDF.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/TextToPDF.java 2016-04-22 16:33:16.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/TextToPDF.java 2016-12-05 19:30:18.000000000 +0000
@@ -24,6 +24,7 @@
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
+import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDSimpleFont;
@@ -40,6 +41,7 @@
public class TextToPDF
{
private int fontSize = 10;
+ private boolean landscape = false;
private PDSimpleFont font = PDType1Font.HELVETICA;
/**
@@ -73,12 +75,17 @@
final int margin = 40;
float height = font.getFontDescriptor().getFontBoundingBox().getHeight()/1000;
+ PDRectangle mediaBox = PDPage.PAGE_SIZE_LETTER;
+ if (landscape)
+ {
+ mediaBox = new PDRectangle(mediaBox.getHeight(), mediaBox.getWidth());
+ }
//calculate font height and increase by 5 percent.
height = height*fontSize*1.05f;
BufferedReader data = new BufferedReader( text );
String nextLine = null;
- PDPage page = new PDPage();
+ PDPage page = new PDPage(mediaBox);
PDPageContentStream contentStream = null;
float y = -1;
float maxStringLength = page.getMediaBox().getWidth() - 2*margin;
@@ -94,20 +101,61 @@
// the text.
textIsEmpty = false;
- String[] lineWords = nextLine.trim().split( " " );
+ String[] lineWords = nextLine.replaceAll("[\\n\\r]+$", "").split(" ");
int lineIndex = 0;
while( lineIndex < lineWords.length )
{
- StringBuffer nextLineToDraw = new StringBuffer();
+ StringBuilder nextLineToDraw = new StringBuilder();
float lengthIfUsingNextWord = 0;
+ boolean ff = false;
do
{
- nextLineToDraw.append( lineWords[lineIndex] );
- nextLineToDraw.append( " " );
- lineIndex++;
+ String word1, word2 = "";
+ int indexFF = lineWords[lineIndex].indexOf('\f');
+ if (indexFF == -1)
+ {
+ word1 = lineWords[lineIndex];
+ }
+ else
+ {
+ ff = true;
+ word1 = lineWords[lineIndex].substring(0, indexFF);
+ if (indexFF < lineWords[lineIndex].length())
+ {
+ word2 = lineWords[lineIndex].substring(indexFF + 1);
+ }
+ }
+ // word1 is the part before ff, word2 after
+ // both can be empty
+ // word1 can also be empty without ff, if a line has many spaces
+ if (word1.length() > 0 || !ff)
+ {
+ nextLineToDraw.append(word1);
+ nextLineToDraw.append(" ");
+ }
+ if (!ff || word2.length() == 0)
+ {
+ lineIndex++;
+ }
+ else
+ {
+ lineWords[lineIndex] = word2;
+ }
+ if (ff)
+ {
+ break;
+ }
if( lineIndex < lineWords.length )
{
- String lineWithNextWord = nextLineToDraw.toString() + lineWords[lineIndex];
+ // need cut off at \f in next word to avoid IllegalArgumentException
+ String nextWord = lineWords[lineIndex];
+ indexFF = nextWord.indexOf('\f');
+ if (indexFF != -1)
+ {
+ nextWord = nextWord.substring(0, indexFF);
+ }
+
+ String lineWithNextWord = nextLineToDraw.toString() + " " + nextWord;
lengthIfUsingNextWord =
(font.getStringWidth( lineWithNextWord )/1000) * fontSize;
}
@@ -118,7 +166,7 @@
{
// We have crossed the end-of-page boundary and need to extend the
// document by another page.
- page = new PDPage();
+ page = new PDPage(mediaBox);
doc.addPage( page );
if( contentStream != null )
{
@@ -142,6 +190,18 @@
contentStream.moveTextPositionByAmount( 0, -height);
y -= height;
contentStream.drawString( nextLineToDraw.toString() );
+ if (ff)
+ {
+ page = new PDPage(mediaBox);
+ doc.addPage(page);
+ contentStream.endText();
+ contentStream.close();
+ contentStream = new PDPageContentStream(doc, page);
+ contentStream.setFont(font, fontSize);
+ contentStream.beginText();
+ y = page.getMediaBox().getHeight() - margin + height;
+ contentStream.moveTextPositionByAmount(margin, y);
+ }
}
@@ -210,6 +270,10 @@
i++;
app.setFontSize( Integer.parseInt( args[i] ) );
}
+ else if( args[i].equals( "-landscape" ))
+ {
+ app.setLandscape(true);
+ }
else
{
throw new IOException( "Unknown argument:" + args[i] );
@@ -243,6 +307,7 @@
}
System.err.println( " -ttf The TTF font to use.");
System.err.println( " -fontSize default:10" );
+ System.err.println( " -landscape sets orientation to landscape" );
}
@@ -274,4 +339,25 @@
{
this.fontSize = aFontSize;
}
+
+ /**
+ * Tells the paper orientation.
+ *
+ * @return
+ */
+ public boolean isLandscape()
+ {
+ return landscape;
+ }
+
+ /**
+ * Sets paper orientation.
+ *
+ * @param landscape
+ */
+ public void setLandscape(boolean landscape)
+ {
+ this.landscape = landscape;
+ }
+
}
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java 2016-12-05 19:30:18.000000000 +0000
@@ -195,7 +195,7 @@
}
String offset = formatTZoffset(cal.get(Calendar.ZONE_OFFSET)
+ cal.get(Calendar.DST_OFFSET), "'");
- return String.format("D:"
+ return String.format(Locale.US, "D:"
+ "%1$4tY%1$2tm%1$2td" // yyyyMMdd
+ "%1$2tH%1$2tM%1$2tS" // HHmmss
+ "%2$s" // time zone
@@ -216,7 +216,7 @@
{
String offset = formatTZoffset(cal.get(Calendar.ZONE_OFFSET)
+ cal.get(Calendar.DST_OFFSET), ":");
- return String.format(
+ return String.format(Locale.US,
"%1$4tY" // yyyy
+ "-%1$2tm" // -mm (%tm adds one to cal month value)
+ "-%1$2td" // -dd (%tm adds one to cal month value)
@@ -227,14 +227,25 @@
}
/**
- * Constrain a timezone offset to the range [-11:59 thru +11:59].
+ * Constrain a timezone offset to the range [-14:00 thru +14:00].
* @param proposedOffset A value intended to be a timezone offset.
* @return The corresponding value reduced to the above noted range
* by adding or subtracting multiples of a full day.
*/
public static int restrainTZoffset(long proposedOffset)
{
+ if (proposedOffset <= 14 * MILLIS_PER_HOUR && proposedOffset >= -14 * MILLIS_PER_HOUR)
+ {
+ // https://www.w3.org/TR/xmlschema-2/#dateTime-timezones
+ // Timezones between 14:00 and -14:00 are valid
+ return (int) proposedOffset;
+ }
+ // Constrain a timezone offset to the range [-11:59 thru +12:00].
proposedOffset = ((proposedOffset+HALF_DAY)%DAY+DAY)%DAY;
+ if (proposedOffset == 0)
+ {
+ return HALF_DAY;
+ }
// 0 <= proposedOffset < DAY
proposedOffset = (proposedOffset-HALF_DAY)%HALF_DAY;
// -HALF_DAY < proposedOffset < HALF_DAY
@@ -486,7 +497,7 @@
{ // we parsed a time zone in default format
int hrSign = (sign == '-' ? -1 :+1);
tz.setRawOffset(restrainTZoffset(hrSign*(tzHours*MILLIS_PER_HOUR + tzMin*MILLIS_PER_MINUTE)));
- tz.setID("unknown");
+ updateZoneId(tz);
}
else if ( ! hadGMT)
{ // try to process as a name; "GMT" or "UTC" has already been processed
@@ -509,6 +520,43 @@
}
/**
+ * Update the zone ID based on the raw offset. This is either GMT, GMT+hh:mm or GMT-hh:mm, where
+ * n is between 1 and 14. The highest negative hour is -14, the highest positive hour is 12.
+ * Zones that don't fit in this schema are set to zone ID "unknown".
+ *
+ * @param tz the time zone to update.
+ */
+ private static void updateZoneId(TimeZone tz)
+ {
+ // https://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/
+ int offset = tz.getRawOffset();
+ char pm = '+';
+ if (offset < 0)
+ {
+ pm = '-';
+ offset = -offset;
+ }
+ int hh = offset / 3600000;
+ int mm = offset % 3600000 / 60000;
+ if (offset == 0)
+ {
+ tz.setID("GMT");
+ }
+ else if (pm == '+' && hh <= 12)
+ {
+ tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
+ }
+ else if (pm == '-' && hh <= 14)
+ {
+ tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
+ }
+ else
+ {
+ tz.setID("unknown");
+ }
+ }
+
+ /**
* Parses a big-endian date: year month day hour min sec.
* The year must be four digits. Other fields may be adjacent
* and delimited by length or they may follow appropriate delimiters.
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java 2016-12-05 19:30:18.000000000 +0000
@@ -447,6 +447,13 @@
destCatalog.getCOSDictionary().setItem(COSName.METADATA, newStream);
}
+ COSDictionary destOCP = (COSDictionary) destCatalog.getCOSDictionary().getDictionaryObject(COSName.OCPROPERTIES);
+ COSDictionary srcOCP = (COSDictionary) srcCatalog.getCOSDictionary().getDictionaryObject(COSName.OCPROPERTIES);
+ if (destOCP == null && srcOCP != null)
+ {
+ destCatalog.getCOSDictionary().setItem(COSName.OCPROPERTIES, cloner.cloneForNewDocument(srcOCP));
+ }
+
// merge logical structure hierarchy if logical structure information is available in both source pdf and
// destination pdf
boolean mergeStructTree = false;
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java
--- libpdfbox-java-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java 2016-04-22 16:33:18.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java 2016-12-05 19:30:18.000000000 +0000
@@ -35,6 +35,22 @@
{
private static final Log LOG = LogFactory.getLog(TIFFUtil.class);
+ private static String tagSetClassName = "com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet";
+
+ static
+ {
+ try
+ {
+ String alternateClassName = "com.github.jaiimageio.plugins.tiff.BaselineTIFFTagSet";
+ Class.forName(alternateClassName);
+ tagSetClassName = alternateClassName;
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // ignore
+ }
+ }
+
/**
* Sets the ImageIO parameter compression type based on the given image.
* @param image buffered image used to decide compression type
@@ -81,8 +97,7 @@
if (root.getElementsByTagName("TIFFIFD").getLength() == 0)
{
ifd = new IIOMetadataNode("TIFFIFD");
- ifd.setAttribute("tagSets",
- "com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet");
+ ifd.setAttribute("tagSets", tagSetClassName);
root.appendChild(ifd);
}
else
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
--- libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java 2016-04-22 16:33:20.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java 2016-12-05 19:30:12.000000000 +0000
@@ -207,7 +207,10 @@
// check permissions
assertEquals(expectedPermissions.isOwnerPermission(), currentAccessPermission.isOwnerPermission());
- assertEquals(expectedPermissions.isReadOnly(), currentAccessPermission.isReadOnly());
+ if (!expectedPermissions.isOwnerPermission())
+ {
+ assertEquals(true, currentAccessPermission.isReadOnly());
+ }
assertEquals(expectedPermissions.canAssembleDocument(), currentAccessPermission.canAssembleDocument());
assertEquals(expectedPermissions.canExtractContent(), currentAccessPermission.canExtractContent());
assertEquals(expectedPermissions.canExtractForAccessibility(), currentAccessPermission.canExtractForAccessibility());
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
--- libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java 2016-04-22 16:33:20.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java 2016-12-05 19:30:10.000000000 +0000
@@ -108,7 +108,7 @@
assertTrue(outputIntents.isEmpty());
// add an OutputIntent
- colorProfile = TestPDDocumentCatalog.class.getResourceAsStream("sRGB Color Space Profile.icm");
+ colorProfile = TestPDDocumentCatalog.class.getResourceAsStream("sRGB.icc");
// create output intent
PDOutputIntent oi = new PDOutputIntent(doc, colorProfile);
oi.setInfo("sRGB IEC61966-2.1");
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java
--- libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java 2016-04-22 16:33:20.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java 2016-12-05 19:30:10.000000000 +0000
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.Locale;
import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.io.IOUtils;
diff -Nru libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java
--- libpdfbox-java-1.8.12/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java 2016-04-22 16:33:20.000000000 +0000
+++ libpdfbox-java-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java 2016-12-05 19:30:12.000000000 +0000
@@ -151,9 +151,9 @@
int hr, int min, int sec, int offsetHours, int offsetMinutes,
String orig) throws Exception
{
- String pdfDate = String.format("D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",
+ String pdfDate = String.format(Locale.US, "D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",
yr,mon,day,hr,min,sec,offsetHours,offsetMinutes);
- String iso8601Date = String.format("%04d-%02d-%02d"
+ String iso8601Date = String.format(Locale.US, "%04d-%02d-%02d"
+ "T%02d:%02d:%02d%+03d:%02d",
yr,mon,day,hr,min,sec,offsetHours,offsetMinutes);
Calendar cal = null;
@@ -328,6 +328,8 @@
// ambiguous big-endian date
checkParse(2073,12,25, 0, 8, 0, 0, 0, "2073 12 25:08");
+ // PDFBOX-3315 GMT+12
+ checkParse(2016, 4,11,16,01,15, 12, 0, "D:20160411160115+12'00'");
}
private static void checkToString(int yr, int mon, int day,
@@ -338,9 +340,9 @@
GregorianCalendar cal = new GregorianCalendar(tz, Locale.ENGLISH);
cal.set(yr, mon-1, day, hr, min, sec);
// create expected strings
- String pdfDate = String.format("D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",
+ String pdfDate = String.format(Locale.US, "D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",
yr,mon,day,hr,min,sec,offsetHours, offsetMinutes);
- String iso8601Date = String.format("%04d-%02d-%02d"
+ String iso8601Date = String.format(Locale.US, "%04d-%02d-%02d"
+ "T%02d:%02d:%02d%+03d:%02d",
yr,mon,day,hr,min,sec,offsetHours, offsetMinutes);
// compare outputs from toString and toISO8601 with expected values
@@ -403,14 +405,15 @@
*/
public void testParseTZ()
{
+ // 1st parameter is what to expect
checkParseTZ(0*HRS+0*MINS, "+00:00");
checkParseTZ(0*HRS+0*MINS, "-0000");
checkParseTZ(1*HRS+0*MINS, "+1:00");
checkParseTZ(-(1*HRS+0*MINS), "-1:00");
checkParseTZ(-(1*HRS+30*MINS), "-0130");
checkParseTZ(11*HRS+59*MINS, "1159");
- checkParseTZ(-(11*HRS+30*MINS), "1230");
- checkParseTZ(11*HRS+30*MINS, "-12:30");
+ checkParseTZ(12*HRS+30*MINS, "1230");
+ checkParseTZ(-(12*HRS+30*MINS), "-12:30");
checkParseTZ(0*HRS+0*MINS, "Z");
checkParseTZ(-(8*HRS+0*MINS), "PST");
checkParseTZ(0*HRS+0*MINS, "EDT"); // EDT does not parse
@@ -426,6 +429,11 @@
checkParseTZ((5*HRS+0*MINS), "+0500");
checkParseTZ((11*HRS+0*MINS), "+11'00'");
checkParseTZ(0, "Z");
+ // PDFBOX-3315, PDFBOX-2420
+ checkParseTZ(12*HRS+0*MINS, "+12:00");
+ checkParseTZ(-(12*HRS+0*MINS), "-12:00");
+ checkParseTZ(14*HRS+0*MINS, "1400");
+ checkParseTZ(-(14*HRS+0*MINS), "-1400");
}
private static void checkFormatOffset(double off, String expect)
@@ -440,22 +448,26 @@
*/
public void testFormatTZoffset()
{
- checkFormatOffset(-12.1, "+11:54");
- checkFormatOffset(12.1, "-11:54");
+ // 2nd parameter is what to expect
+ checkFormatOffset(-12.1, "-12:06");
+ checkFormatOffset(12.1, "+12:06");
checkFormatOffset(0, "+00:00");
checkFormatOffset(-1, "-01:00");
checkFormatOffset(.5, "+00:30");
checkFormatOffset(-0.5, "-00:30");
checkFormatOffset(.1, "+00:06");
checkFormatOffset(-0.1, "-00:06");
- checkFormatOffset(-12, "+00:00");
- checkFormatOffset(12, "+00:00");
+ checkFormatOffset(-12, "-12:00");
+ checkFormatOffset(12, "+12:00");
checkFormatOffset(-11.5, "-11:30");
checkFormatOffset(11.5, "+11:30");
checkFormatOffset(11.9, "+11:54");
checkFormatOffset(11.1, "+11:06");
checkFormatOffset(-11.9, "-11:54");
checkFormatOffset(-11.1, "-11:06");
+ // PDFBOX-2420
+ checkFormatOffset(14, "+14:00");
+ checkFormatOffset(-14, "-14:00");
}
// testbody precedes
diff -Nru libpdfbox-java-1.8.12/pom.xml libpdfbox-java-1.8.13/pom.xml
--- libpdfbox-java-1.8.12/pom.xml 2016-04-22 16:33:24.000000000 +0000
+++ libpdfbox-java-1.8.13/pom.xml 2016-12-05 19:30:08.000000000 +0000
@@ -23,7 +23,7 @@
org.apache.pdfbox
pdfbox-parent
- 1.8.12
+ 1.8.13
parent/pom.xml
@@ -34,12 +34,12 @@
- scm:svn:http://svn.apache.org/repos/asf/pdfbox/tags/1.8.12
+ scm:svn:http://svn.apache.org/repos/asf/pdfbox/tags/1.8.13
- scm:svn:https://svn.apache.org/repos/asf/pdfbox/tags/1.8.12
+ scm:svn:https://svn.apache.org/repos/asf/pdfbox/tags/1.8.13
- http://svn.apache.org/viewvc/pdfbox/tags/1.8.12
+ http://svn.apache.org/viewvc/pdfbox/tags/1.8.13
diff -Nru libpdfbox-java-1.8.12/preflight/pom.xml libpdfbox-java-1.8.13/preflight/pom.xml
--- libpdfbox-java-1.8.12/preflight/pom.xml 2016-04-22 16:33:24.000000000 +0000
+++ libpdfbox-java-1.8.13/preflight/pom.xml 2016-12-05 19:30:08.000000000 +0000
@@ -26,7 +26,7 @@
org.apache.pdfbox
pdfbox-parent
- 1.8.12
+ 1.8.13
../parent/pom.xml
@@ -91,8 +91,12 @@
com.googlecode.maven-download-plugin
- download-maven-plugin
- 1.2.1
+
+ maven-download-plugin
+ 1.1.0
+
+ ${skipTests}
+
get-isartor
@@ -101,7 +105,7 @@
wget
- http://www.pdfa.org/wp-content/uploads/2011/08/isartor-pdfa-2008-08-13.zip
+ https://www.pdfa.org/wp-content/until2016_uploads/2011/08/isartor-pdfa-2008-08-13.zip
true
${project.build.directory}/pdfs
9f129c834bc6f9f8dabad4491c4c10ec
diff -Nru libpdfbox-java-1.8.12/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/PDFAIdentificationValidation.java libpdfbox-java-1.8.13/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/PDFAIdentificationValidation.java
--- libpdfbox-java-1.8.12/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/PDFAIdentificationValidation.java 2016-04-22 16:33:22.000000000 +0000
+++ libpdfbox-java-1.8.13/preflight/src/main/java/org/apache/pdfbox/preflight/metadata/PDFAIdentificationValidation.java 2016-12-05 19:30:08.000000000 +0000
@@ -85,7 +85,7 @@
}
}
checkConformanceLevel(ve, id.getConformance());
- checkPartNumber(ve, id.getPart());
+ checkPartNumber(ve, id.getPart() == null ? -1 : id.getPart());
return ve;
}
diff -Nru libpdfbox-java-1.8.12/preflight/src/test/java/org/apache/pdfbox/preflight/TestPreflightPath.java libpdfbox-java-1.8.13/preflight/src/test/java/org/apache/pdfbox/preflight/TestPreflightPath.java
--- libpdfbox-java-1.8.12/preflight/src/test/java/org/apache/pdfbox/preflight/TestPreflightPath.java 2016-04-22 16:33:22.000000000 +0000
+++ libpdfbox-java-1.8.13/preflight/src/test/java/org/apache/pdfbox/preflight/TestPreflightPath.java 2016-12-05 19:30:08.000000000 +0000
@@ -63,7 +63,7 @@
assertEquals(1, position);
Integer i = path.getPathElement(position, Integer.class);
- assertEquals(new Integer(6), i);
+ assertEquals(Integer.valueOf(6), i);
Object str = path.peek();
assertEquals(3, path.size());
diff -Nru libpdfbox-java-1.8.12/preflight-app/pom.xml libpdfbox-java-1.8.13/preflight-app/pom.xml
--- libpdfbox-java-1.8.12/preflight-app/pom.xml 2016-04-22 16:33:12.000000000 +0000
+++ libpdfbox-java-1.8.13/preflight-app/pom.xml 2016-12-05 19:30:08.000000000 +0000
@@ -23,7 +23,7 @@
org.apache.pdfbox
pdfbox-parent
- 1.8.12
+ 1.8.13
../parent/pom.xml
diff -Nru libpdfbox-java-1.8.12/RELEASE-NOTES.txt libpdfbox-java-1.8.13/RELEASE-NOTES.txt
--- libpdfbox-java-1.8.12/RELEASE-NOTES.txt 2016-04-22 16:33:22.000000000 +0000
+++ libpdfbox-java-1.8.13/RELEASE-NOTES.txt 2016-12-05 19:30:08.000000000 +0000
@@ -1,11 +1,11 @@
-Release Notes -- Apache PDFBox -- Version 1.8.12
+Release Notes -- Apache PDFBox -- Version 1.8.13
Introduction
------------
The Apache PDFBox library is an open source Java tool for working with PDF documents.
-This is an incremental bugfix release based on the earlier 1.8.11 release. It
+This is an incremental bugfix release based on the earlier 1.8.12 release. It
contains a couple of fixes and small improvements.
For more details on all fixes included in this release, please refer to the following
@@ -13,40 +13,50 @@
Bug
-[PDFBOX-1995] - AdobePDFSchema.getProducer() returns empty string
-[PDFBOX-2428] - An error occured when reading table hmtx
-[PDFBOX-3024] - Preflight validation call PDType0Font.clear at the wrong time
-[PDFBOX-3116] - COSNumber NumberFormatException for large number
-[PDFBOX-3201] - Skip zlib-header and checksum to avoid DataFormatException
-[PDFBOX-3204] - JVM crashes on PDFRenderer.renderImageWithDPI
-[PDFBOX-3217] - PdfaExtensionHelper.populatePDFAPropertyType
-[PDFBOX-3226] - No such Element Exception processing File
-[PDFBOX-3229] - Decryption fails when Metadata not encrypted but EncryptMetadata is true/default.
-[PDFBOX-3235] - ColorSpace validation fails for inlined image
-[PDFBOX-3237] - ASCII85Filter does not use or recognize the correct end-of-data terminator
-[PDFBOX-3254] - Corrupted XMP causes java.lang.StringIndexOutOfBoundsException
-[PDFBOX-3257] - XMPSchemaBasic setCreateDate and setModifyDate don't work if already set
-[PDFBOX-3258] - XMPBox XMPBasicSchema setters don't work if already set
-[PDFBOX-3259] - ClassCastException in PDTilingPattern.getContents
-[PDFBOX-3285] - All lines that use a given font stop rendering if 'รถ' is inserted -
-ArrayIndexOutOfBoundsException in TTFSubFont.buildPostTable
-[PDFBOX-3297] - Infinite loop
-[PDFBOX-3299] - TIFF-files with FillOrder=2 can't be converted to PDF
-[PDFBOX-3308] - Missing endOfName chars
-[PDFBOX-3321] - ASCII stream data size is increased when written
+[PDFBOX-2420] - DateConverter doesn't handle time zones outside -12 to +12 range properly
+[PDFBOX-2919] - org.apache.fontbox.cff.CFFParser.readEntry sometimes throws java.lang.IllegalArgumentException
+[PDFBOX-3315] - Dates falsely detected as different by preflight
+[PDFBOX-3335] - Issue while Merging PDF with Hidden Layers
+[PDFBOX-3341] - currentAccessPermission.setReadOnly() not set in StandardSecurityHandler
+[PDFBOX-3355] - PDPageLabels.getLabelsByPageIndices() returns Uppercase letters for style a
+[PDFBOX-3368] - ContainsKey don't work for the Map returned by PDStructureTreeRoot.getRoleMap
+[PDFBOX-3369] - Error expected floating point number actual='0.00-35095424'
+[PDFBOX-3409] - TextToPDF drops leading spaces
+[PDFBOX-3420] - Can't sign pdf with a particular attachment
+[PDFBOX-3446] - Infinite loop while parsing
+[PDFBOX-3448] - NullPointerException at org.apache.pdfbox.pdmodel.common.COSArrayList.convertFloatCOSArrayToList
+[PDFBOX-3450] - ArrayIndexOutOfBoundsException at org.apache.fontbox.cmap.CMapParser.increment
+[PDFBOX-3463] - XMPSchemaBasic.getLabel() always returns null
+[PDFBOX-3466] - Java 9 warnings
+[PDFBOX-3472] - NPE when PDF/A identification metadata does not contain ID
+[PDFBOX-3477] - CA and ca values should be clipped
+[PDFBOX-3481] - Localization in XRef generation results in unusable PDFs
+[PDFBOX-3487] - ClassCastException in COSWriter.write() when saving PDF
+[PDFBOX-3491] - NumberFormatException in CFFParser.readRealNumber
+[PDFBOX-3500] - Error expected floating point number actual='0.-262'
+[PDFBOX-3532] - Java 6 errors
+[PDFBOX-3546] - IOException over DataFormatException, "invalid stored block lengths" on a valid PDF
+[PDFBOX-3551] - CLI Decrypt broken, only allows 1 argument
+[PDFBOX-3555] - FlateFilter.decode cause native memory leaks
+[PDFBOX-3558] - NPE in JBig2Filter if BitsPerComponent is missing
+[PDFBOX-3570] - JDK-8054565 Java 8 close contract issue
+[PDFBOX-3571] - sRGB Color Space Profile is subject to 3rd party copyright
+[PDFBOX-3578] - java.lang.IllegalArgumentException: dash lengths all zero
+[PDFBOX-3590] - AccessPermission not applied
+[PDFBOX-3594] - Use PDOutlineItem#findDestinationPage() cannot get PDPage, return was null
+[PDFBOX-3609] - ClassCastException in PDCIDFont.readWidths()
Improvement
-[PDFBOX-1840] - Automatically load isartor for preflight tests
-[PDFBOX-3196] - Update maven plugins and apache parent pom
-[PDFBOX-3231] - Update PDPropBuildDataDict
-[PDFBOX-3251] - Improve parsing and validation of ColorSpace for inline image
-[PDFBOX-3295] - Improve parsing performance of object streams
+[PDFBOX-3352] - Calendar values are parsed with unknown timezones
-Wish
+New Feature
-[PDFBOX-3241] - return original PDF Header
+[PDFBOX-3410] - TextToPDF needs orientation control
+Task
+
+[PDFBOX-3577] - remove mygrid repository in 1.8
Release Contents
----------------
diff -Nru libpdfbox-java-1.8.12/war/pom.xml libpdfbox-java-1.8.13/war/pom.xml
--- libpdfbox-java-1.8.12/war/pom.xml 2016-04-22 16:33:24.000000000 +0000
+++ libpdfbox-java-1.8.13/war/pom.xml 2016-12-05 19:30:08.000000000 +0000
@@ -23,7 +23,7 @@
org.apache.pdfbox
pdfbox-parent
- 1.8.12
+ 1.8.13
../parent/pom.xml
diff -Nru libpdfbox-java-1.8.12/xmpbox/pom.xml libpdfbox-java-1.8.13/xmpbox/pom.xml
--- libpdfbox-java-1.8.12/xmpbox/pom.xml 2016-04-22 16:33:12.000000000 +0000
+++ libpdfbox-java-1.8.13/xmpbox/pom.xml 2016-12-05 19:30:08.000000000 +0000
@@ -27,7 +27,7 @@
org.apache.pdfbox
pdfbox-parent
- 1.8.12
+ 1.8.13
../parent/pom.xml
diff -Nru libpdfbox-java-1.8.12/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java libpdfbox-java-1.8.13/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java
--- libpdfbox-java-1.8.12/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java 2016-04-22 16:33:12.000000000 +0000
+++ libpdfbox-java-1.8.13/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java 2016-12-05 19:30:08.000000000 +0000
@@ -28,6 +28,7 @@
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.SimpleTimeZone;
+import java.util.TimeZone;
/**
* This class is used to convert dates to strings and back using the PDF date standards. Date are described in
@@ -174,6 +175,7 @@
}
else
{
+ updateZoneId(zone);
retval = new GregorianCalendar(zone);
}
retval.clear();
@@ -217,6 +219,43 @@
}
/**
+ * Update the zone ID based on the raw offset. This is either GMT, GMT+hh:mm or GMT-hh:mm, where
+ * n is between 1 and 14. The highest negative hour is -14, the highest positive hour is 12.
+ * Zones that don't fit in this schema are set to zone ID "unknown".
+ *
+ * @param tz the time zone to update.
+ */
+ private static void updateZoneId(TimeZone tz)
+ {
+ // https://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/
+ int offset = tz.getRawOffset();
+ char pm = '+';
+ if (offset < 0)
+ {
+ pm = '-';
+ offset = -offset;
+ }
+ int hh = offset / 3600000;
+ int mm = offset % 3600000 / 60000;
+ if (offset == 0)
+ {
+ tz.setID("GMT");
+ }
+ else if (pm == '+' && hh <= 12)
+ {
+ tz.setID(String.format("GMT+%02d:%02d", hh, mm));
+ }
+ else if (pm == '-' && hh <= 14)
+ {
+ tz.setID(String.format("GMT-%02d:%02d", hh, mm));
+ }
+ else
+ {
+ tz.setID("unknown");
+ }
+ }
+
+ /**
* Append Zero to String Buffer before number < 10 ('1' become '01')
*
* @param out
diff -Nru libpdfbox-java-1.8.12/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java libpdfbox-java-1.8.13/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java
--- libpdfbox-java-1.8.12/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java 2016-04-22 16:33:12.000000000 +0000
+++ libpdfbox-java-1.8.13/xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java 2016-12-05 19:30:08.000000000 +0000
@@ -190,7 +190,7 @@
/**
* Give the PDFAVersionId (as an integer)
*
- * @return Part value (Integer)
+ * @return Part value (Integer) or null if it is missing
*/
public Integer getPart()
{
diff -Nru libpdfbox-java-1.8.12/xmpbox/src/test/java/org/apache/xmpbox/parser/DeserializationTest.java libpdfbox-java-1.8.13/xmpbox/src/test/java/org/apache/xmpbox/parser/DeserializationTest.java
--- libpdfbox-java-1.8.12/xmpbox/src/test/java/org/apache/xmpbox/parser/DeserializationTest.java 2016-04-22 16:33:12.000000000 +0000
+++ libpdfbox-java-1.8.13/xmpbox/src/test/java/org/apache/xmpbox/parser/DeserializationTest.java 2016-12-05 19:30:08.000000000 +0000
@@ -143,14 +143,14 @@
Assert.assertEquals(2, thumbs.size());
ThumbnailType thumb = thumbs.get(0);
- Assert.assertEquals(new Integer(162), thumb.getHeight());
- Assert.assertEquals(new Integer(216), thumb.getWidth());
+ Assert.assertEquals(Integer.valueOf(162), thumb.getHeight());
+ Assert.assertEquals(Integer.valueOf(216), thumb.getWidth());
Assert.assertEquals("JPEG", thumb.getFormat());
Assert.assertEquals("/9j/4AAQSkZJRgABAgEASABIAAD", thumb.getImage());
thumb = thumbs.get(1);
- Assert.assertEquals(new Integer(162), thumb.getHeight());
- Assert.assertEquals(new Integer(216), thumb.getWidth());
+ Assert.assertEquals(Integer.valueOf(162), thumb.getHeight());
+ Assert.assertEquals(Integer.valueOf(216), thumb.getWidth());
Assert.assertEquals("JPEG", thumb.getFormat());
Assert.assertEquals("/9j/4AAQSkZJRgABAgEASABIAAD", thumb.getImage());