public class Overlay extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
Overlay.Position
Possible location of the overlayed pages: foreground or background.
|
Constructor and Description |
---|
Overlay() |
Modifier and Type | Method and Description |
---|---|
protected AffineTransform |
calculateAffineTransform(PDPage page,
PDRectangle overlayMediaBox)
Calculate the transform to be used when positioning the overlay.
|
void |
close()
Close all input documents which were used for the overlay and opened by this class.
|
String |
getDefaultOverlayFile()
Returns the default overlay file.
|
String |
getInputFile()
Returns the input file.
|
PDDocument |
overlay(Map<Integer,String> specificPageOverlayFile)
This will add overlays to a document.
|
PDDocument |
overlayDocuments(Map<Integer,PDDocument> specificPageOverlayDocuments)
This will add overlays documents to a document.
|
void |
setAllPagesOverlayFile(String allPagesOverlayFile)
Sets the all pages overlay file.
|
void |
setAllPagesOverlayPDF(PDDocument allPagesOverlayPDF)
Sets the all pages overlay PDF.
|
void |
setDefaultOverlayFile(String defaultOverlayFile)
Sets the default overlay file.
|
void |
setDefaultOverlayPDF(PDDocument defaultOverlayPDF)
Sets the default overlay PDF.
|
void |
setEvenPageOverlayFile(String evenPageOverlayFile)
Sets the even page overlay file.
|
void |
setEvenPageOverlayPDF(PDDocument evenPageOverlayPDF)
Sets the even page overlay PDF.
|
void |
setFirstPageOverlayFile(String firstPageOverlayFile)
Sets the first page overlay file.
|
void |
setFirstPageOverlayPDF(PDDocument firstPageOverlayPDF)
Sets the first page overlay PDF.
|
void |
setInputFile(String inputFile)
Sets the file to be overlayed.
|
void |
setInputPDF(PDDocument inputPDF)
Sets the PDF to be overlayed.
|
void |
setLastPageOverlayFile(String lastPageOverlayFile)
Sets the last page overlay file.
|
void |
setLastPageOverlayPDF(PDDocument lastPageOverlayPDF)
Sets the last page overlay PDF.
|
void |
setOddPageOverlayFile(String oddPageOverlayFile)
Sets the odd page overlay file.
|
void |
setOddPageOverlayPDF(PDDocument oddPageOverlayPDF)
Sets the odd page overlay PDF.
|
void |
setOverlayPosition(Overlay.Position overlayPosition)
Sets the overlay position.
|
public PDDocument overlay(Map<Integer,String> specificPageOverlayFile) throws IOException
specificPageOverlayFile
- map of overlay files for specific pages. The page numbers are
1-based.setInputPDF(PDDocument)
then it is that object that is returned.IOException
- if something went wrongpublic PDDocument overlayDocuments(Map<Integer,PDDocument> specificPageOverlayDocuments) throws IOException
specificPageOverlayDocuments
- map of overlay documents for specific pages. The page
numbers are 1-based.setInputPDF(PDDocument)
then it is that object that is returned.IOException
- if something went wrongpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if something went wrongprotected AffineTransform calculateAffineTransform(PDPage page, PDRectangle overlayMediaBox)
page
- The page that will get the overlay.overlayMediaBox
- The overlay media box.public void setOverlayPosition(Overlay.Position overlayPosition)
overlayPosition
- the overlay positionpublic void setInputFile(String inputFile)
inputFile
- the file to be overlayed. The PDDocument
object gathered from
opening this file will be returned by
overlay(Map<Integer, String>)
.public void setInputPDF(PDDocument inputPDF)
inputPDF
- the PDF to be overlayed. This will be the object that is returned by
overlay(Map<Integer, String>)
.public String getInputFile()
public void setDefaultOverlayFile(String defaultOverlayFile)
defaultOverlayFile
- the default overlay filepublic void setDefaultOverlayPDF(PDDocument defaultOverlayPDF)
defaultOverlayPDF
- the default overlay PDFpublic String getDefaultOverlayFile()
public void setFirstPageOverlayFile(String firstPageOverlayFile)
firstPageOverlayFile
- the first page overlay filepublic void setFirstPageOverlayPDF(PDDocument firstPageOverlayPDF)
firstPageOverlayPDF
- the first page overlay PDFpublic void setLastPageOverlayFile(String lastPageOverlayFile)
lastPageOverlayFile
- the last page overlay filepublic void setLastPageOverlayPDF(PDDocument lastPageOverlayPDF)
lastPageOverlayPDF
- the last page overlay PDFpublic void setAllPagesOverlayFile(String allPagesOverlayFile)
allPagesOverlayFile
- the all pages overlay filepublic void setAllPagesOverlayPDF(PDDocument allPagesOverlayPDF)
allPagesOverlayPDF
- the all pages overlay PDF. This should not be a PDDocument that you
created on the fly, it should be saved first, if it contains any fonts that are subset.public void setOddPageOverlayFile(String oddPageOverlayFile)
oddPageOverlayFile
- the odd page overlay filepublic void setOddPageOverlayPDF(PDDocument oddPageOverlayPDF)
oddPageOverlayPDF
- the odd page overlay PDFpublic void setEvenPageOverlayFile(String evenPageOverlayFile)
evenPageOverlayFile
- the even page overlay filepublic void setEvenPageOverlayPDF(PDDocument evenPageOverlayPDF)
evenPageOverlayPDF
- the even page overlay PDFCopyright © 2002–2018 The Apache Software Foundation. All rights reserved.