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 2014/11/19 14:34:41 UTC
svn commit: r1640546 - in /pdfbox/trunk:
pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java
tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java
Author: lehmi
Date: Wed Nov 19 13:34:40 2014
New Revision: 1640546
URL: http://svn.apache.org/r1640546
Log:
PDFBOX-2430: removed command line parser switch from overlay tool, switch to use the non-sequential parser
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java
pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java?rev=1640546&r1=1640545&r2=1640546&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java Wed Nov 19 13:34:40 2014
@@ -83,10 +83,9 @@ public class Overlay
* This will add overlays to a documents.
*
* @param specificPageOverlayFile map of overlay files for specific pages
- * @param useNonSeqParser indicates whether the nonsequential parser is used
* @throws IOException if something went wrong
*/
- public void overlay(Map<Integer, String> specificPageOverlayFile, boolean useNonSeqParser)
+ public void overlay(Map<Integer, String> specificPageOverlayFile)
throws IOException
{
PDDocument sourcePDFDocument = null;
@@ -98,42 +97,42 @@ public class Overlay
PDDocument evenPageOverlay = null;
try
{
- sourcePDFDocument = loadPDF(inputFileName,useNonSeqParser);
+ sourcePDFDocument = loadPDF(inputFileName);
if (defaultOverlayFilename != null)
{
- defaultOverlay = loadPDF(defaultOverlayFilename, useNonSeqParser);
+ defaultOverlay = loadPDF(defaultOverlayFilename);
defaultOverlayPage = getLayoutPage(defaultOverlay);
}
if (firstPageOverlayFilename != null)
{
- firstPageOverlay = loadPDF(firstPageOverlayFilename, useNonSeqParser);
+ firstPageOverlay = loadPDF(firstPageOverlayFilename);
firstPageOverlayPage = getLayoutPage(firstPageOverlay);
}
if (lastPageOverlayFilename != null)
{
- lastPageOverlay = loadPDF(lastPageOverlayFilename, useNonSeqParser);
+ lastPageOverlay = loadPDF(lastPageOverlayFilename);
lastPageOverlayPage = getLayoutPage(lastPageOverlay);
}
if (oddPageOverlayFilename != null)
{
- oddPageOverlay = loadPDF(oddPageOverlayFilename, useNonSeqParser);
+ oddPageOverlay = loadPDF(oddPageOverlayFilename);
oddPageOverlayPage = getLayoutPage(oddPageOverlay);
}
if (evenPageOverlayFilename != null)
{
- evenPageOverlay = loadPDF(evenPageOverlayFilename, useNonSeqParser);
+ evenPageOverlay = loadPDF(evenPageOverlayFilename);
evenPageOverlayPage = getLayoutPage(evenPageOverlay);
}
if (allPagesOverlayFilename != null)
{
- allPagesOverlay = loadPDF(allPagesOverlayFilename, useNonSeqParser);
+ allPagesOverlay = loadPDF(allPagesOverlayFilename);
specificPageOverlayPage = getLayoutPages(allPagesOverlay);
useAllOverlayPages = true;
numberOfOverlayPages = specificPageOverlayPage.size();
}
for (Map.Entry<Integer, String> e : specificPageOverlayFile.entrySet())
{
- PDDocument doc = loadPDF(e.getValue(), useNonSeqParser);
+ PDDocument doc = loadPDF(e.getValue());
specificPageOverlay.put(e.getKey(), doc);
specificPageOverlayPage.put(e.getKey(), getLayoutPage(doc));
}
@@ -180,18 +179,9 @@ public class Overlay
}
}
- private PDDocument loadPDF(String pdfName, boolean useNonSeqParser) throws IOException
+ private PDDocument loadPDF(String pdfName) throws IOException
{
- PDDocument pdf = null;
- if (useNonSeqParser)
- {
- pdf = PDDocument.loadNonSeq(new File(pdfName), null);
- }
- else
- {
- pdf = PDDocument.load(pdfName);
- }
- return pdf;
+ return PDDocument.loadNonSeq(new File(pdfName));
}
/**
Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java?rev=1640546&r1=1640545&r2=1640546&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java Wed Nov 19 13:34:40 2014
@@ -43,7 +43,6 @@ public class OverlayPDF
private static final String LAST = "-last";
private static final String PAGE = "-page";
private static final String USEALLPAGES = "-useAllPages";
- private static final String NONSEQ = "-nonSeq";
/**
* This will overlay a document and write out the results.
@@ -58,7 +57,6 @@ public class OverlayPDF
Overlay overlayer = new Overlay();
Map<Integer, String> specificPageOverlayFile = new HashMap<Integer, String>();
- boolean useNonSeqParser = false;
// input arguments
for (int i = 0; i < args.length; i++)
{
@@ -117,10 +115,6 @@ public class OverlayPDF
specificPageOverlayFile.put(Integer.parseInt(args[i + 1].trim()), args[i + 2].trim());
i += 2;
}
- else if( args[i].equals( NONSEQ ) )
- {
- useNonSeqParser = true;
- }
else if (overlayer.getDefaultOverlayFile() == null)
{
overlayer.setDefaultOverlayFile(arg);
@@ -138,7 +132,7 @@ public class OverlayPDF
try
{
- overlayer.overlay(specificPageOverlayFile,useNonSeqParser);
+ overlayer.overlay(specificPageOverlayFile);
}
catch (Exception e)
{
@@ -163,7 +157,6 @@ public class OverlayPDF
"the given page number, may occur more than once\n");
message.append(" -position foreground|background where to put the overlay " +
"file: foreground or background\n");
- message.append(" -nonSeq enables the new non-sequential parser\n");
message.append(" <output.pdf> output file\n");
System.err.println(message.toString());
System.exit( 1 );