You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/11/11 08:03:53 UTC
svn commit: r1846338 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
Author: tilman
Date: Sun Nov 11 08:03:53 2018
New Revision: 1846338
URL: http://svn.apache.org/viewvc?rev=1846338&view=rev
Log:
PDFBOX-4375: add method that works with documents
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java?rev=1846338&r1=1846337&r2=1846338&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java Sun Nov 11 08:03:53 2018
@@ -127,8 +127,35 @@ public class Overlay implements Closeabl
}
/**
- * Close all input pdfs which were used for the overlay.
- *
+ * This will add overlays documents to a document.
+ *
+ * @param specificPageOverlayDocuments map of overlay documents for specific pages. The page
+ * numbers are 1-based.
+ *
+ * @return The modified input PDF document, which has to be saved and closed by the caller. If
+ * the input document was passed by {@link #setInputPDF(PDDocument) setInputPDF(PDDocument)}
+ * then it is that object that is returned.
+ *
+ * @throws IOException if something went wrong
+ */
+ public PDDocument overlayDocuments(Map<Integer, PDDocument> specificPageOverlayDocuments) throws IOException
+ {
+ loadPDFs();
+ for (Map.Entry<Integer, PDDocument> e : specificPageOverlayDocuments.entrySet())
+ {
+ PDDocument doc = e.getValue();
+ if (doc != null)
+ {
+ specificPageOverlayPage.put(e.getKey(), getLayoutPage(doc));
+ }
+ }
+ processPages(inputPDFDocument);
+ return inputPDFDocument;
+ }
+
+ /**
+ * Close all input documents which were used for the overlay and opened by this class.
+ *
* @throws IOException if something went wrong
*/
@Override