You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2019/10/05 13:23:29 UTC
svn commit: r1868015 [1/3] - in /pdfbox/branches/issue4569/pdfbox/src:
main/java/org/apache/pdfbox/multipdf/ main/java/org/apache/pdfbox/pdfparser/
main/java/org/apache/pdfbox/pdfwriter/ main/java/org/apache/pdfbox/pdmodel/
main/java/org/apache/pdfbox/...
Author: lehmi
Date: Sat Oct 5 13:23:29 2019
New Revision: 1868015
URL: http://svn.apache.org/viewvc?rev=1868015&view=rev
Log:
PDFBOX-4569: moved load methods to parser
Modified:
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCaretAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFreeTextAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDInkAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolylineAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquigglyAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDStrikeoutAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDUnderlineAppearanceHandler.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java
pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSName.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFCloneUtilityTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PageExtractorTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/EndstreamOutputStreamTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTransitions.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/CCITTFactoryTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactoryTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/ValidateXImage.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/AcroFormsRotationTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/AlignmentTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/HandleDifferentDALevelsTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/MultilineFieldsTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroFormFlattenTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroFormTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDButtonTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestRendering.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java
pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java Sat Oct 5 13:23:29 2019
@@ -36,6 +36,7 @@ import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.io.IOUtils;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDResources;
@@ -261,7 +262,7 @@ public class Overlay implements Closeabl
private PDDocument loadPDF(String pdfName) throws IOException
{
- return PDDocument.load(new File(pdfName));
+ return PDFParser.load(new File(pdfName));
}
/**
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java Sat Oct 5 13:23:29 2019
@@ -45,6 +45,7 @@ import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.apache.pdfbox.pdmodel.PDDocumentNameDestinationDictionary;
@@ -369,11 +370,11 @@ public class PDFMergerUtility
{
if (sourceObject instanceof File)
{
- sourceDoc = PDDocument.load((File) sourceObject, memUsageSetting);
+ sourceDoc = PDFParser.load((File) sourceObject, memUsageSetting);
}
else
{
- sourceDoc = PDDocument.load((InputStream) sourceObject, memUsageSetting);
+ sourceDoc = PDFParser.load((InputStream) sourceObject, memUsageSetting);
}
for (PDPage page : sourceDoc.getPages())
{
@@ -445,11 +446,11 @@ public class PDFMergerUtility
PDDocument sourceDoc = null;
if (sourceObject instanceof File)
{
- sourceDoc = PDDocument.load((File) sourceObject, partitionedMemSetting);
+ sourceDoc = PDFParser.load((File) sourceObject, partitionedMemSetting);
}
else
{
- sourceDoc = PDDocument.load((InputStream) sourceObject,
+ sourceDoc = PDFParser.load((InputStream) sourceObject,
partitionedMemSetting);
}
tobeclosed.add(sourceDoc);
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java Sat Oct 5 13:23:29 2019
@@ -18,6 +18,7 @@
package org.apache.pdfbox.multipdf;
import java.io.IOException;
+
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Sat Oct 5 13:23:29 2019
@@ -16,6 +16,7 @@
*/
package org.apache.pdfbox.pdfparser;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -25,6 +26,9 @@ import org.apache.pdfbox.cos.COSDictiona
import org.apache.pdfbox.cos.COSDocument;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.io.IOUtils;
+import org.apache.pdfbox.io.MemoryUsageSetting;
+import org.apache.pdfbox.io.RandomAccessBuffer;
+import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream;
import org.apache.pdfbox.io.RandomAccessRead;
import org.apache.pdfbox.io.ScratchFile;
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -124,6 +128,80 @@ public class PDFParser extends COSParser
init(scratchFile);
}
+ /**
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param input byte array that contains the document.
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the PDF required a non-empty password.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(byte[] input) throws IOException
+ {
+ return load(input, "");
+ }
+
+ /**
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param input byte array that contains the document.
+ * @param password password to be used for decryption
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(byte[] input, String password) throws IOException
+ {
+ return load(input, password, null, null);
+ }
+
+ /**
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param input byte array that contains the document.
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(byte[] input, String password, InputStream keyStore, String alias)
+ throws IOException
+ {
+ return load(input, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF.
+ *
+ * @param input byte array that contains the document.
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(byte[] input, String password, InputStream keyStore, String alias,
+ MemoryUsageSetting memUsageSetting) throws IOException
+ {
+ ScratchFile scratchFile = new ScratchFile(memUsageSetting);
+ RandomAccessRead source = new RandomAccessBuffer(input);
+ PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
+ parser.parse();
+ return parser.getPDDocument();
+ }
+
private void init(ScratchFile scratchFile) throws IOException
{
String eofLookupRangeStr = System.getProperty(SYSPROP_EOFLOOKUPRANGE);
@@ -143,8 +221,260 @@ public class PDFParser extends COSParser
}
/**
- * This will get the PD document that was parsed. When you are done with
- * this document you must call close() on it to release resources.
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param file file to be loaded
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the file required a non-empty password.
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file) throws IOException
+ {
+ return load(file, "", MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF.
+ *
+ * @param file file to be loaded
+ * @param memUsageSetting defines how memory is used for buffering PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the file required a non-empty password.
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file, MemoryUsageSetting memUsageSetting) throws IOException
+ {
+ return load(file, "", null, null, memUsageSetting);
+ }
+
+ /**
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param file file to be loaded
+ * @param password password to be used for decryption
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file, String password) throws IOException
+ {
+ return load(file, password, null, null, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF.
+ *
+ * @param file file to be loaded
+ * @param password password to be used for decryption
+ * @param memUsageSetting defines how memory is used for buffering PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file, String password, MemoryUsageSetting memUsageSetting)
+ throws IOException
+ {
+ return load(file, password, null, null, memUsageSetting);
+ }
+
+ /**
+ * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
+ *
+ * @param file file to be loaded
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ *
+ * @return loaded document
+ *
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file, String password, InputStream keyStore, String alias)
+ throws IOException
+ {
+ return load(file, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF.
+ *
+ * @param file file to be loaded
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ * @param memUsageSetting defines how memory is used for buffering PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws IOException in case of a file reading or parsing error
+ */
+ public static PDDocument load(File file, String password, InputStream keyStore, String alias,
+ MemoryUsageSetting memUsageSetting) throws IOException
+ {
+ @SuppressWarnings({ "squid:S2095" }) // raFile not closed here, may be needed for signing
+ RandomAccessBufferedFileInputStream raFile = new RandomAccessBufferedFileInputStream(file);
+ try
+ {
+ return load(raFile, password, keyStore, alias, memUsageSetting);
+ }
+ catch (IOException ioe)
+ {
+ IOUtils.closeQuietly(raFile);
+ throw ioe;
+ }
+ }
+
+ private static PDDocument load(RandomAccessBufferedFileInputStream raFile, String password,
+ InputStream keyStore, String alias, MemoryUsageSetting memUsageSetting)
+ throws IOException
+ {
+ ScratchFile scratchFile = new ScratchFile(memUsageSetting);
+ try
+ {
+ PDFParser parser = new PDFParser(raFile, password, keyStore, alias, scratchFile);
+ parser.parse();
+ return parser.getPDDocument();
+ }
+ catch (IOException ioe)
+ {
+ IOUtils.closeQuietly(scratchFile);
+ throw ioe;
+ }
+ }
+
+ /**
+ * Parses a PDF. The given input stream is copied to the memory to enable random access to the pdf. Unrestricted
+ * main memory will be used for buffering PDF streams.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the PDF required a non-empty password.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input) throws IOException
+ {
+ return load(input, "", null, null, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF. Depending on the memory settings parameter the given input stream is either copied to main memory
+ * or to a temporary file to enable random access to the pdf.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the PDF required a non-empty password.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input, MemoryUsageSetting memUsageSetting)
+ throws IOException
+ {
+ return load(input, "", null, null, memUsageSetting);
+ }
+
+ /**
+ * Parses a PDF. The given input stream is copied to the memory to enable random access to the pdf. Unrestricted
+ * main memory will be used for buffering PDF streams.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ * @param password password to be used for decryption
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input, String password) throws IOException
+ {
+ return load(input, password, null, null, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF. The given input stream is copied to the memory to enable random access to the pdf. Unrestricted
+ * main memory will be used for buffering PDF streams.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ *
+ * @return loaded document
+ *
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input, String password, InputStream keyStore,
+ String alias) throws IOException
+ {
+ return load(input, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
+ }
+
+ /**
+ * Parses a PDF. Depending on the memory settings parameter the given input stream is either copied to main memory
+ * or to a temporary file to enable random access to the pdf.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ * @param password password to be used for decryption
+ * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input, String password,
+ MemoryUsageSetting memUsageSetting) throws IOException
+ {
+ return load(input, password, null, null, memUsageSetting);
+ }
+
+ /**
+ * Parses a PDF. Depending on the memory settings parameter the given input stream is either copied to memory or to
+ * a temporary file to enable random access to the pdf.
+ *
+ * @param input stream that contains the document. Don't forget to close it after loading.
+ * @param password password to be used for decryption
+ * @param keyStore key store to be used for decryption when using public key security
+ * @param alias alias to be used for decryption when using public key security
+ * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
+ *
+ * @return loaded document
+ *
+ * @throws InvalidPasswordException If the password is incorrect.
+ * @throws IOException In case of a reading or parsing error.
+ */
+ public static PDDocument load(InputStream input, String password, InputStream keyStore,
+ String alias, MemoryUsageSetting memUsageSetting) throws IOException
+ {
+ ScratchFile scratchFile = new ScratchFile(memUsageSetting);
+ try
+ {
+ RandomAccessRead source = scratchFile.createBuffer(input);
+ PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
+ parser.parse();
+ return parser.getPDDocument();
+ }
+ catch (IOException ioe)
+ {
+ IOUtils.closeQuietly(scratchFile);
+ throw ioe;
+ }
+ }
+
+ /**
+ * This will get the PD document that was parsed. When you are done with this document you must call close() on it
+ * to release resources.
*
* @return The document at the PD layer.
*
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Sat Oct 5 13:23:29 2019
@@ -59,8 +59,8 @@ import org.apache.pdfbox.cos.ICOSVisitor
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.io.RandomAccessInputStream;
import org.apache.pdfbox.io.RandomAccessRead;
-import org.apache.pdfbox.pdfparser.PDFXRefStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFXRefStream;
import org.apache.pdfbox.pdmodel.encryption.SecurityHandler;
import org.apache.pdfbox.pdmodel.fdf.FDFDocument;
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.COSFilterInputStream;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java Sat Oct 5 13:23:29 2019
@@ -45,6 +45,7 @@ import org.apache.pdfbox.contentstream.o
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdfwriter.COSWriter;
import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList;
import org.apache.pdfbox.pdmodel.font.PDFont;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Sat Oct 5 13:23:29 2019
@@ -25,7 +25,6 @@ import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
@@ -46,17 +45,13 @@ import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.cos.COSUpdateInfo;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.io.MemoryUsageSetting;
-import org.apache.pdfbox.io.RandomAccessBuffer;
-import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream;
import org.apache.pdfbox.io.RandomAccessRead;
import org.apache.pdfbox.io.ScratchFile;
-import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdfwriter.COSWriter;
import org.apache.pdfbox.pdmodel.common.COSArrayList;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.common.PDStream;
import org.apache.pdfbox.pdmodel.encryption.AccessPermission;
-import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;
import org.apache.pdfbox.pdmodel.encryption.PDEncryption;
import org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy;
import org.apache.pdfbox.pdmodel.encryption.SecurityHandler;
@@ -883,337 +878,6 @@ public class PDDocument implements Close
{
return fontsToSubset;
}
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param file file to be loaded
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the file required a non-empty password.
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file) throws IOException
- {
- return load(file, "", MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF.
- *
- * @param file file to be loaded
- * @param memUsageSetting defines how memory is used for buffering PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the file required a non-empty password.
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file, MemoryUsageSetting memUsageSetting)
- throws IOException
- {
- return load(file, "", null, null, memUsageSetting);
- }
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param file file to be loaded
- * @param password password to be used for decryption
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file, String password)
- throws IOException
- {
- return load(file, password, null, null, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF.
- *
- * @param file file to be loaded
- * @param password password to be used for decryption
- * @param memUsageSetting defines how memory is used for buffering PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file, String password, MemoryUsageSetting memUsageSetting)
- throws IOException
- {
- return load(file, password, null, null, memUsageSetting);
- }
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param file file to be loaded
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- *
- * @return loaded document
- *
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file, String password, InputStream keyStore, String alias)
- throws IOException
- {
- return load(file, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF.
- *
- * @param file file to be loaded
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- * @param memUsageSetting defines how memory is used for buffering PDF streams
- *
- * @return loaded document
- *
- * @throws IOException in case of a file reading or parsing error
- */
- public static PDDocument load(File file, String password, InputStream keyStore, String alias,
- MemoryUsageSetting memUsageSetting) throws IOException
- {
- @SuppressWarnings({"squid:S2095"}) // raFile not closed here, may be needed for signing
- RandomAccessBufferedFileInputStream raFile = new RandomAccessBufferedFileInputStream(file);
- try
- {
- return load(raFile, password, keyStore, alias, memUsageSetting);
- }
- catch (IOException ioe)
- {
- IOUtils.closeQuietly(raFile);
- throw ioe;
- }
- }
-
- private static PDDocument load(RandomAccessBufferedFileInputStream raFile, String password,
- InputStream keyStore, String alias,
- MemoryUsageSetting memUsageSetting) throws IOException
- {
- ScratchFile scratchFile = new ScratchFile(memUsageSetting);
- try
- {
- PDFParser parser = new PDFParser(raFile, password, keyStore, alias, scratchFile);
- parser.parse();
- return parser.getPDDocument();
- }
- catch (IOException ioe)
- {
- IOUtils.closeQuietly(scratchFile);
- throw ioe;
- }
- }
-
- /**
- * Parses a PDF. The given input stream is copied to the memory to enable random access to the
- * pdf. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the PDF required a non-empty password.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input) throws IOException
- {
- return load(input, "", null, null, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF. Depending on the memory settings parameter the given input stream is either
- * copied to main memory or to a temporary file to enable random access to the pdf.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the PDF required a non-empty password.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input, MemoryUsageSetting memUsageSetting)
- throws IOException
- {
- return load(input, "", null, null, memUsageSetting);
- }
-
- /**
- * Parses a PDF. The given input stream is copied to the memory to enable random access to the
- * pdf. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- * @param password password to be used for decryption
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input, String password)
- throws IOException
- {
- return load(input, password, null, null, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF. The given input stream is copied to the memory to enable random access to the
- * pdf. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- *
- * @return loaded document
- *
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input, String password, InputStream keyStore, String alias)
- throws IOException
- {
- return load(input, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF. Depending on the memory settings parameter the given input stream is either
- * copied to main memory or to a temporary file to enable random access to the pdf.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- * @param password password to be used for decryption
- * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input, String password, MemoryUsageSetting memUsageSetting)
- throws IOException
- {
- return load(input, password, null, null, memUsageSetting);
- }
-
- /**
- * Parses a PDF. Depending on the memory settings parameter the given input stream is either
- * copied to memory or to a temporary file to enable random access to the pdf.
- *
- * @param input stream that contains the document. Don't forget to close it after loading.
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(InputStream input, String password, InputStream keyStore,
- String alias, MemoryUsageSetting memUsageSetting) throws IOException
- {
- ScratchFile scratchFile = new ScratchFile(memUsageSetting);
- try
- {
- RandomAccessRead source = scratchFile.createBuffer(input);
- PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
- parser.parse();
- return parser.getPDDocument();
- }
- catch (IOException ioe)
- {
- IOUtils.closeQuietly(scratchFile);
- throw ioe;
- }
- }
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input byte array that contains the document.
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the PDF required a non-empty password.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(byte[] input) throws IOException
- {
- return load(input, "");
- }
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input byte array that contains the document.
- * @param password password to be used for decryption
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(byte[] input, String password)
- throws IOException
- {
- return load(input, password, null, null);
- }
-
- /**
- * Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.
- *
- * @param input byte array that contains the document.
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(byte[] input, String password, InputStream keyStore,
- String alias) throws IOException
- {
- return load(input, password, keyStore, alias, MemoryUsageSetting.setupMainMemoryOnly());
- }
-
- /**
- * Parses a PDF.
- *
- * @param input byte array that contains the document.
- * @param password password to be used for decryption
- * @param keyStore key store to be used for decryption when using public key security
- * @param alias alias to be used for decryption when using public key security
- * @param memUsageSetting defines how memory is used for buffering input stream and PDF streams
- *
- * @return loaded document
- *
- * @throws InvalidPasswordException If the password is incorrect.
- * @throws IOException In case of a reading or parsing error.
- */
- public static PDDocument load(byte[] input, String password, InputStream keyStore,
- String alias, MemoryUsageSetting memUsageSetting) throws IOException
- {
- ScratchFile scratchFile = new ScratchFile(memUsageSetting);
- RandomAccessRead source = new RandomAccessBuffer(input);
- PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
- parser.parse();
- return parser.getPDDocument();
- }
-
/**
* Save the document to a file.
*
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,13 +24,13 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.pdfbox.cos.COSStream;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationSquareCircle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCaretAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCaretAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCaretAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCaretAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -19,11 +19,11 @@ import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationCaret;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.Matrix;
/**
@@ -117,4 +117,4 @@ public class PDCaretAppearanceHandler ex
{
// TODO to be implemented
}
-}
\ No newline at end of file
+}
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -23,11 +23,11 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationCircle;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFreeTextAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFreeTextAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFreeTextAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFreeTextAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -28,9 +28,9 @@ import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSNumber;
import org.apache.pdfbox.cos.COSObject;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdfparser.PDFStreamParser;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDFont;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -22,6 +22,7 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSStream;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDFormContentStream;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
@@ -32,7 +33,6 @@ import org.apache.pdfbox.pdmodel.graphic
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationHighlight;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
/**
*
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDInkAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDInkAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDInkAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDInkAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -22,8 +22,8 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationInk;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
/**
* Handler to generate the ink annotations appearance.
@@ -114,4 +114,4 @@ public class PDInkAppearanceHandler exte
{
// No down appearance generated
}
-}
\ No newline at end of file
+}
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,8 +24,9 @@ import org.apache.pdfbox.pdmodel.font.PD
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
+
import static org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine.LE_NONE;
import static org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDAbstractAppearanceHandler.ANGLED_STYLES;
import org.apache.pdfbox.util.Matrix;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,13 +24,13 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceGray;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLink;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary;
/**
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,11 +24,11 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPolygon;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderEffectDictionary;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolylineAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolylineAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolylineAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolylineAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -23,12 +23,13 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPolyline;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
+
import static org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine.LE_NONE;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,11 +24,11 @@ import org.apache.commons.logging.LogFac
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationSquare;
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
-import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderEffectDictionary;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquigglyAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquigglyAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquigglyAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquigglyAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -21,8 +21,8 @@ import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDFormContentStream;
import org.apache.pdfbox.pdmodel.PDPatternContentStream;
import org.apache.pdfbox.pdmodel.PDResources;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDStrikeoutAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDStrikeoutAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDStrikeoutAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDStrikeoutAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -23,8 +23,8 @@ import org.apache.pdfbox.pdmodel.common.
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationStrikeout;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
/**
*
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -24,8 +24,8 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.pdmodel.graphics.blend.BlendMode;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDUnderlineAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDUnderlineAppearanceHandler.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDUnderlineAppearanceHandler.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDUnderlineAppearanceHandler.java Sat Oct 5 13:23:29 2019
@@ -23,8 +23,8 @@ import org.apache.pdfbox.pdmodel.common.
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnderline;
-import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
/**
*
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java Sat Oct 5 13:23:29 2019
@@ -26,8 +26,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSDocument;
import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdfwriter.COSWriter;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfwriter.COSWriter;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java Sat Oct 5 13:23:29 2019
@@ -28,6 +28,7 @@ import java.io.InputStream;
import javax.imageio.ImageIO;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
@@ -165,7 +166,7 @@ public class PDVisibleSignDesigner
private void calculatePageSizeFromFile(String filename, int page) throws IOException
{
- try (PDDocument document = PDDocument.load(new File(filename)))
+ try (PDDocument document = PDFParser.load(new File(filename)))
{
// calculate height and width of document page
calculatePageSize(document, page);
@@ -174,7 +175,7 @@ public class PDVisibleSignDesigner
private void calculatePageSizeFromStream(InputStream documentStream, int page) throws IOException
{
- try (PDDocument document = PDDocument.load(documentStream))
+ try (PDDocument document = PDFParser.load(documentStream))
{
// calculate height and width of document page
calculatePageSize(document, page);
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java Sat Oct 5 13:23:29 2019
@@ -22,6 +22,7 @@ import java.awt.print.Book;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
+
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPrintable.java Sat Oct 5 13:23:29 2019
@@ -29,6 +29,7 @@ import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterIOException;
import java.io.IOException;
+
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSName.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSName.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSName.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSName.java Sat Oct 5 13:23:29 2019
@@ -18,7 +18,9 @@ package org.apache.pdfbox.cos;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDPage;
import org.junit.Assert;
import org.junit.Test;
@@ -44,7 +46,7 @@ public class TestCOSName
document.save(baos);
}
- try (PDDocument document = PDDocument.load(baos.toByteArray()))
+ try (PDDocument document = PDFParser.load(baos.toByteArray()))
{
COSDictionary catalogDict = document.getDocumentCatalog().getCOSObject();
Assert.assertTrue(catalogDict.containsKey(special));
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java Sat Oct 5 13:23:29 2019
@@ -29,6 +29,7 @@ import javax.crypto.Cipher;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.encryption.AccessPermission;
import org.apache.pdfbox.pdmodel.encryption.PublicKeyProtectionPolicy;
import org.apache.pdfbox.pdmodel.encryption.PublicKeyRecipient;
@@ -83,7 +84,7 @@ public class TestPublicKeyEncryption
* @return
*/
@Parameterized.Parameters
- public static Collection keyLengths()
+ public static Collection<Integer> keyLengths()
{
return Arrays.asList(40, 128, 256);
}
@@ -134,7 +135,7 @@ public class TestPublicKeyEncryption
keyStore1 = "test1.pfx";
keyStore2 = "test2.pfx";
- document = PDDocument.load(new File(this.getClass().getResource("test.pdf").toURI()));
+ document = PDFParser.load(new File(this.getClass().getResource("test.pdf").toURI()));
text = new PDFTextStripper().getText(document);
producer = document.getDocumentInformation().getProducer();
document.setVersion(1.7f);
@@ -275,7 +276,7 @@ public class TestPublicKeyEncryption
private PDDocument reload(File file, String decryptionPassword, InputStream keyStore)
throws IOException, NoSuchAlgorithmException
{
- PDDocument doc2 = PDDocument.load(file, decryptionPassword,
+ PDDocument doc2 = PDFParser.load(file, decryptionPassword,
keyStore, null, MemoryUsageSetting.setupMainMemoryOnly());
Assert.assertEquals("Extracted text is different",
text,
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java Sat Oct 5 13:23:29 2019
@@ -35,6 +35,7 @@ import org.apache.pdfbox.cos.COSDictiona
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
@@ -168,7 +169,7 @@ public class TestSymmetricKeyEncryption
private void checkPerms(byte[] inputFileAsByteArray, String password,
AccessPermission expectedPermissions) throws IOException
{
- try (PDDocument doc = PDDocument.load(inputFileAsByteArray, password))
+ try (PDDocument doc = PDFParser.load(inputFileAsByteArray, password))
{
AccessPermission currentAccessPermission = doc.getCurrentAccessPermission();
@@ -300,7 +301,7 @@ public class TestSymmetricKeyEncryption
doc.save(file);
}
- try (PDDocument doc = PDDocument.load(file))
+ try (PDDocument doc = PDFParser.load(file))
{
Assert.assertTrue(doc.isEncrypted());
for (int i = 0; i < TESTCOUNT; ++i)
@@ -318,7 +319,7 @@ public class TestSymmetricKeyEncryption
String userpassword, String ownerpassword,
AccessPermission permission) throws IOException
{
- PDDocument document = PDDocument.load(inputFileAsByteArray);
+ PDDocument document = PDFParser.load(inputFileAsByteArray);
String prefix = "Simple-";
int numSrcPages = document.getNumberOfPages();
PDFRenderer pdfRenderer = new PDFRenderer(document);
@@ -386,7 +387,7 @@ public class TestSymmetricKeyEncryption
sizeEncrypted != sizePriorToEncr);
// test with owner password => full permissions
- PDDocument encryptedDoc = PDDocument.load(pdfFile, ownerpassword);
+ PDDocument encryptedDoc = PDFParser.load(pdfFile, ownerpassword);
Assert.assertTrue(encryptedDoc.isEncrypted());
Assert.assertTrue(encryptedDoc.getCurrentAccessPermission().isOwnerPermission());
@@ -408,7 +409,7 @@ public class TestSymmetricKeyEncryption
encryptedDoc.close();
// test with user password => restricted permissions
- encryptedDoc = PDDocument.load(pdfFile, userpassword);
+ encryptedDoc = PDFParser.load(pdfFile, userpassword);
Assert.assertTrue(encryptedDoc.isEncrypted());
Assert.assertFalse(encryptedDoc.getCurrentAccessPermission().isOwnerPermission());
@@ -420,8 +421,7 @@ public class TestSymmetricKeyEncryption
// extract the embedded file, saves it, and return the extracted saved file
private File extractEmbeddedFile(InputStream pdfInputStream, String name) throws IOException
{
- PDDocument docWithEmbeddedFile;
- docWithEmbeddedFile = PDDocument.load(pdfInputStream);
+ PDDocument docWithEmbeddedFile = PDFParser.load(pdfInputStream);
PDDocumentCatalog catalog = docWithEmbeddedFile.getDocumentCatalog();
PDDocumentNameDictionary names = catalog.getNames();
PDEmbeddedFilesNameTreeNode embeddedFiles = names.getEmbeddedFiles();
@@ -450,7 +450,7 @@ public class TestSymmetricKeyEncryption
File embeddedFilePriorToEncryption,
String userpassword, String ownerpassword) throws IOException
{
- PDDocument document = PDDocument.load(inputFileWithEmbeddedFileAsByteArray);
+ PDDocument document = PDFParser.load(inputFileWithEmbeddedFileAsByteArray);
try (PDDocument encryptedDoc = encrypt(keyLength, preferAES, sizePriorToEncr, document, "ContainsEmbedded-", permission, userpassword, ownerpassword))
{
File decryptedFile = new File(testResultsDir, "DecryptedContainsEmbedded-" + keyLength + "-bit-" + (preferAES ? "AES" : "RC4") + ".pdf");
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java Sat Oct 5 13:23:29 2019
@@ -28,7 +28,7 @@ import junit.framework.TestCase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.io.IOUtils;
-import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
/**
* This will test all of the filters in the PDFBox system.
@@ -125,7 +125,7 @@ public class TestFilters extends TestCas
*/
public void testPDFBOX4517() throws IOException
{
- PDDocument.load(new File("target/pdfs/PDFBOX-4517-cryptfilter.pdf"),
+ PDFParser.load(new File("target/pdfs/PDFBOX-4517-cryptfilter.pdf"),
"userpassword1234");
}
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAcroFormsTest.java Sat Oct 5 13:23:29 2019
@@ -31,6 +31,7 @@ import org.apache.pdfbox.cos.COSDictiona
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.multipdf.PDFMergerUtility.AcroFormMergeMode;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.junit.Before;
@@ -68,8 +69,10 @@ public class MergeAcroFormsTest
merger.mergeDocuments(null);
merger.setAcroFormMergeMode(AcroFormMergeMode.PDFBOX_LEGACY_MODE);
- try (PDDocument compliantDocument = PDDocument.load(new File(IN_DIR,"PDFBoxLegacyMerge-SameMerged.pdf"));
- PDDocument toBeCompared = PDDocument.load(new File(OUT_DIR,"PDFBoxLegacyMerge-SameMerged.pdf")))
+ try (PDDocument compliantDocument = PDFParser
+ .load(new File(IN_DIR, "PDFBoxLegacyMerge-SameMerged.pdf"));
+ PDDocument toBeCompared = PDFParser
+ .load(new File(OUT_DIR, "PDFBoxLegacyMerge-SameMerged.pdf")))
{
PDAcroForm compliantAcroForm = compliantDocument.getDocumentCatalog().getAcroForm();
PDAcroForm toBeComparedAcroForm = toBeCompared.getDocumentCatalog().getAcroForm();
@@ -145,7 +148,7 @@ public class MergeAcroFormsTest
}
// Test merge result
- try (PDDocument mergedPDF = PDDocument.load(pdfOutput))
+ try (PDDocument mergedPDF = PDFParser.load(pdfOutput))
{
assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
@@ -180,7 +183,7 @@ public class MergeAcroFormsTest
}
// Test merge result
- try (PDDocument mergedPDF = PDDocument.load(pdfOutput))
+ try (PDDocument mergedPDF = PDFParser.load(pdfOutput))
{
assertEquals("There shall be 2 pages", 2, mergedPDF.getNumberOfPages());
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/MergeAnnotationsTest.java Sat Oct 5 13:23:29 2019
@@ -29,6 +29,7 @@ import java.util.Map;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocumentNameDestinationDictionary;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.junit.Before;
@@ -70,7 +71,7 @@ public class MergeAnnotationsTest
merger.mergeDocuments(null);
// Test merge result
- PDDocument mergedPDF = PDDocument.load(pdfOutput);
+ PDDocument mergedPDF = PDFParser.load(pdfOutput);
assertEquals("There shall be 6 pages", 6, mergedPDF.getNumberOfPages());
PDDocumentNameDestinationDictionary destinations = mergedPDF.getDocumentCatalog().getDests();
Modified: pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFCloneUtilityTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFCloneUtilityTest.java?rev=1868015&r1=1868014&r2=1868015&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFCloneUtilityTest.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFCloneUtilityTest.java Sat Oct 5 13:23:29 2019
@@ -19,7 +19,9 @@ import java.awt.Color;
import java.io.File;
import java.io.IOException;
import junit.framework.TestCase;
+
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
@@ -96,9 +98,9 @@ public class PDFCloneUtilityTest extends
// save and reload PDF, so that one can see that the files are legit
dstDoc.save(TESTDIR + CLONEDST);
- PDDocument.load(new File(TESTDIR + CLONESRC)).close();
- PDDocument.load(new File(TESTDIR + CLONESRC), (String)null).close();
- PDDocument.load(new File(TESTDIR + CLONEDST)).close();
- PDDocument.load(new File(TESTDIR + CLONEDST), (String)null).close();
+ PDFParser.load(new File(TESTDIR + CLONESRC)).close();
+ PDFParser.load(new File(TESTDIR + CLONESRC), (String) null).close();
+ PDFParser.load(new File(TESTDIR + CLONEDST)).close();
+ PDFParser.load(new File(TESTDIR + CLONEDST), (String) null).close();
}
}