|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.util.LayerUtility
public class LayerUtility
This class allows to import pages as Form XObjects into a PDF file and use them to create layers (optional content groups).
Constructor Summary | |
---|---|
LayerUtility(PDDocument document)
Creates a new instance. |
Method Summary | |
---|---|
PDOptionalContentGroup |
appendFormAsLayer(PDPage targetPage,
PDXObjectForm form,
java.awt.geom.AffineTransform transform,
java.lang.String layerName)
Places the given form over the existing content of the indicated page (like an overlay). |
PDDocument |
getDocument()
Returns the PDF document we work on. |
PDXObjectForm |
importPageAsForm(PDDocument sourceDoc,
int pageNumber)
Imports a page from some PDF file as a Form XObject so it can be placed on another page in the target document. |
PDXObjectForm |
importPageAsForm(PDDocument sourceDoc,
PDPage page)
Imports a page from some PDF file as a Form XObject so it can be placed on another page in the target document. |
void |
wrapInSaveRestore(PDPage page)
Some applications may not wrap their page content in a save/restore (q/Q) pair which can lead to problems with coordinate system transformations when content is appended. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LayerUtility(PDDocument document)
document
- the PDF document to modifyMethod Detail |
---|
public PDDocument getDocument()
public void wrapInSaveRestore(PDPage page) throws java.io.IOException
page
- the page
java.io.IOException
- if an I/O error occurspublic PDXObjectForm importPageAsForm(PDDocument sourceDoc, int pageNumber) throws java.io.IOException
sourceDoc
- the source PDF document that contains the page to be copiedpageNumber
- the page number of the page to be copied
java.io.IOException
- if an I/O error occurspublic PDXObjectForm importPageAsForm(PDDocument sourceDoc, PDPage page) throws java.io.IOException
sourceDoc
- the source PDF document that contains the page to be copiedpage
- the page in the source PDF document to be copied
java.io.IOException
- if an I/O error occurspublic PDOptionalContentGroup appendFormAsLayer(PDPage targetPage, PDXObjectForm form, java.awt.geom.AffineTransform transform, java.lang.String layerName) throws java.io.IOException
PDOptionalContentProperties
.
targetPage
- the target pageform
- the form to placetransform
- the transformation matrix that controls the placementlayerName
- the name for the layer/OCG to produce
java.io.IOException
- if an I/O error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |