Class PDFTemplateStructure
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDFTemplateStructure
-
public class PDFTemplateStructure extends java.lang.Object
Structure of PDF document with visible signature.
-
-
Field Summary
Fields Modifier and Type Field Description private PDAcroForm
acroForm
private COSDictionary
acroFormDictionary
private java.util.List<PDField>
acroFormFields
private java.awt.geom.AffineTransform
affineTransform
private PDAppearanceDictionary
appearanceDictionary
private PDRectangle
formatterRectangle
private PDFormXObject
holderForm
private PDResources
holderFormResources
private PDStream
holderFormStream
private PDImageXObject
image
private PDFormXObject
imageForm
private COSName
imageFormName
private PDResources
imageFormResources
private PDStream
imageFormStream
private COSName
imageName
private PDFormXObject
innerForm
private COSName
innerFormName
private PDResources
innerFormResources
private PDStream
innerFormStream
private PDPage
page
private PDSignature
pdSignature
private COSArray
procSet
private PDSignatureField
signatureField
private PDRectangle
signatureRectangle
private PDDocument
template
private COSDocument
visualSignature
private COSDictionary
widgetDictionary
-
Constructor Summary
Constructors Constructor Description PDFTemplateStructure()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PDAcroForm
getAcroForm()
Gets AcroFormCOSDictionary
getAcroFormDictionary()
Gets Dictionary of AcroForm.java.util.List<PDField>
getAcroFormFields()
Gets acroFormFieldsjava.awt.geom.AffineTransform
getAffineTransform()
Gets AffineTransformPDAppearanceDictionary
getAppearanceDictionary()
Gets AppearanceDictionary That is /AP entry the appearance dictionary.PDRectangle
getFormatterRectangle()
Gets formatter rectanglePDFormXObject
getHolderForm()
Gets Holder form.PDResources
getHolderFormResources()
Gets Holder form resourcesPDStream
getHolderFormStream()
Sets HolderFormStreamPDImageXObject
getImage()
Gets the image of visible signaturePDFormXObject
getImageForm()
Gets Image form.COSName
getImageFormName()
Gets image form namePDResources
getImageFormResources()
Gets image form resourcesPDStream
getImageFormStream()
Gets Image form streamCOSName
getImageName()
Gets visible signature image namePDFormXObject
getInnerForm()
Gets inner form that is in this location: AcroForm/DR/XObject/{holder form name}/Resources/XObject/{inner name} By default inner form name starts with "n".COSName
getInnerFormName()
Gets name of inner formPDResources
getInnerFormResources()
Gets inner form ResourcePDStream
getInnerFormStream()
Gets Inner form Stream.PDPage
getPage()
Returns document page.PDSignature
getPdSignature()
Gets PDSignatureCOSArray
getProcSet()
Gets ProcSet ArrayPDSignatureField
getSignatureField()
Gets Signature fieldPDRectangle
getSignatureRectangle()
Gets SignatureRectanglePDDocument
getTemplate()
Gets PDDocument template.java.io.ByteArrayInputStream
getTemplateAppearanceStream()
Deprecated.This will be removed in 2.1 because the method name is misleading and confusing, and the work done rather belongs into the calling class:COSDocument
getVisualSignature()
Gets COSDocument of visible Signature.COSDictionary
getWidgetDictionary()
Gets Widget Dictionary.void
setAcroForm(PDAcroForm acroForm)
Sets AcroFormvoid
setAcroFormDictionary(COSDictionary acroFormDictionary)
Acroform have its Dictionary, so we here set the Dictionary which is in this location: AcroForm/DRvoid
setAcroFormFields(java.util.List<PDField> acroFormFields)
Sets acroFormFieldsvoid
setAffineTransform(java.awt.geom.AffineTransform affineTransform)
Sets AffineTransformvoid
setAppearanceDictionary(PDAppearanceDictionary appearanceDictionary)
Sets AppearanceDictionary That is /AP entry the appearance dictionary.void
setFormatterRectangle(PDRectangle formatterRectangle)
Sets formatter rectanglevoid
setHolderForm(PDFormXObject holderForm)
In the structure, form will be contained by XObject in the AcroForm/DR/void
setHolderFormResources(PDResources holderFormResources)
Sets holder form resourcesvoid
setHolderFormStream(PDStream holderFormStream)
Sets stream of holder form Streamvoid
setImage(PDImageXObject image)
Sets the image of visible signaturevoid
setImageForm(PDFormXObject imageForm)
Sets Image form.void
setImageFormName(COSName imageFormName)
Sets image form namevoid
setImageFormResources(PDResources imageFormResources)
Sets image form resourcevoid
setImageFormStream(PDStream imageFormStream)
Sets image form streamvoid
setImageName(COSName imageName)
Sets visible signature image namevoid
setInnerForm(PDFormXObject innerForm)
sets inner form to this location: AcroForm/DR/XObject/{holder form name}/Resources/XObject/{destination}void
setInnerFormName(COSName innerFormName)
Sets inner form namevoid
setInnerFormResources(PDResources innerFormResources)
Sets inner form resourcevoid
setInnterFormStream(PDStream innerFormStream)
Sets inner form streamvoid
setPage(PDPage page)
Sets document pagevoid
setPdSignature(PDSignature pdSignature)
Sets PDSignatureFieldvoid
setProcSet(COSArray procSet)
Sets ProcSet Arrayvoid
setSignatureField(PDSignatureField signatureField)
Sets signature fieldvoid
setSignatureRectangle(PDRectangle signatureRectangle)
Sets SignatureRectanglevoid
setTemplate(PDDocument template)
Wets PDDocument template.void
setVisualSignature(COSDocument visualSignature)
Sets COSDocument of visible Signature.void
setWidgetDictionary(COSDictionary widgetDictionary)
Sets Widget Dictionary.
-
-
-
Field Detail
-
page
private PDPage page
-
template
private PDDocument template
-
acroForm
private PDAcroForm acroForm
-
signatureField
private PDSignatureField signatureField
-
pdSignature
private PDSignature pdSignature
-
acroFormDictionary
private COSDictionary acroFormDictionary
-
signatureRectangle
private PDRectangle signatureRectangle
-
affineTransform
private java.awt.geom.AffineTransform affineTransform
-
procSet
private COSArray procSet
-
image
private PDImageXObject image
-
formatterRectangle
private PDRectangle formatterRectangle
-
holderFormStream
private PDStream holderFormStream
-
holderFormResources
private PDResources holderFormResources
-
holderForm
private PDFormXObject holderForm
-
appearanceDictionary
private PDAppearanceDictionary appearanceDictionary
-
innerFormStream
private PDStream innerFormStream
-
innerFormResources
private PDResources innerFormResources
-
innerForm
private PDFormXObject innerForm
-
imageFormStream
private PDStream imageFormStream
-
imageFormResources
private PDResources imageFormResources
-
acroFormFields
private java.util.List<PDField> acroFormFields
-
innerFormName
private COSName innerFormName
-
imageFormName
private COSName imageFormName
-
imageName
private COSName imageName
-
visualSignature
private COSDocument visualSignature
-
imageForm
private PDFormXObject imageForm
-
widgetDictionary
private COSDictionary widgetDictionary
-
-
Method Detail
-
getPage
public PDPage getPage()
Returns document page.- Returns:
- the page
-
setPage
public void setPage(PDPage page)
Sets document page- Parameters:
page
-
-
getTemplate
public PDDocument getTemplate()
Gets PDDocument template. This represents a digital signature that can be attached to a document- Returns:
- the template
-
setTemplate
public void setTemplate(PDDocument template)
Wets PDDocument template. This represents a digital signature that can be attached to a document- Parameters:
template
-
-
getAcroForm
public PDAcroForm getAcroForm()
Gets AcroForm- Returns:
- the AcroForm
-
setAcroForm
public void setAcroForm(PDAcroForm acroForm)
Sets AcroForm- Parameters:
acroForm
-
-
getSignatureField
public PDSignatureField getSignatureField()
Gets Signature field- Returns:
- the signature field
-
setSignatureField
public void setSignatureField(PDSignatureField signatureField)
Sets signature field- Parameters:
signatureField
-
-
getPdSignature
public PDSignature getPdSignature()
Gets PDSignature- Returns:
- the signature
-
setPdSignature
public void setPdSignature(PDSignature pdSignature)
Sets PDSignatureField- Parameters:
pdSignature
-
-
getAcroFormDictionary
public COSDictionary getAcroFormDictionary()
Gets Dictionary of AcroForm. That's /DR entry in the AcroForm- Returns:
- the AcroForm's dictionary
-
setAcroFormDictionary
public void setAcroFormDictionary(COSDictionary acroFormDictionary)
Acroform have its Dictionary, so we here set the Dictionary which is in this location: AcroForm/DR- Parameters:
acroFormDictionary
-
-
getSignatureRectangle
public PDRectangle getSignatureRectangle()
Gets SignatureRectangle- Returns:
- the rectangle for the signature
-
setSignatureRectangle
public void setSignatureRectangle(PDRectangle signatureRectangle)
Sets SignatureRectangle- Parameters:
signatureRectangle
-
-
getAffineTransform
public java.awt.geom.AffineTransform getAffineTransform()
Gets AffineTransform- Returns:
- the AffineTransform
-
setAffineTransform
public void setAffineTransform(java.awt.geom.AffineTransform affineTransform)
Sets AffineTransform- Parameters:
affineTransform
-
-
getProcSet
public COSArray getProcSet()
Gets ProcSet Array- Returns:
- the PorocSet array
-
setProcSet
public void setProcSet(COSArray procSet)
Sets ProcSet Array- Parameters:
procSet
-
-
getImage
public PDImageXObject getImage()
Gets the image of visible signature- Returns:
- the image making up the visible signature
-
setImage
public void setImage(PDImageXObject image)
Sets the image of visible signature- Parameters:
image
- Image XObject
-
getFormatterRectangle
public PDRectangle getFormatterRectangle()
Gets formatter rectangle- Returns:
- the formatter rectangle
-
setFormatterRectangle
public void setFormatterRectangle(PDRectangle formatterRectangle)
Sets formatter rectangle- Parameters:
formatterRectangle
-
-
getHolderFormStream
public PDStream getHolderFormStream()
Sets HolderFormStream- Returns:
- the holder form stream
-
setHolderFormStream
public void setHolderFormStream(PDStream holderFormStream)
Sets stream of holder form Stream- Parameters:
holderFormStream
-
-
getHolderForm
public PDFormXObject getHolderForm()
Gets Holder form. That form is here AcroForm/DR/XObject/{holder form name} By default, name stars with FRM. We also add number of form to the name.- Returns:
- the holder form
-
setHolderForm
public void setHolderForm(PDFormXObject holderForm)
In the structure, form will be contained by XObject in the AcroForm/DR/- Parameters:
holderForm
-
-
getHolderFormResources
public PDResources getHolderFormResources()
Gets Holder form resources- Returns:
- the holder form's resources
-
setHolderFormResources
public void setHolderFormResources(PDResources holderFormResources)
Sets holder form resources- Parameters:
holderFormResources
-
-
getAppearanceDictionary
public PDAppearanceDictionary getAppearanceDictionary()
Gets AppearanceDictionary That is /AP entry the appearance dictionary.- Returns:
- the Appearance Dictionary
-
setAppearanceDictionary
public void setAppearanceDictionary(PDAppearanceDictionary appearanceDictionary)
Sets AppearanceDictionary That is /AP entry the appearance dictionary.- Parameters:
appearanceDictionary
-
-
getInnerFormStream
public PDStream getInnerFormStream()
Gets Inner form Stream.- Returns:
- the inner form stream
-
setInnterFormStream
public void setInnterFormStream(PDStream innerFormStream)
Sets inner form stream- Parameters:
innerFormStream
-
-
getInnerFormResources
public PDResources getInnerFormResources()
Gets inner form Resource- Returns:
- the inner form's resources
-
setInnerFormResources
public void setInnerFormResources(PDResources innerFormResources)
Sets inner form resource- Parameters:
innerFormResources
-
-
getInnerForm
public PDFormXObject getInnerForm()
Gets inner form that is in this location: AcroForm/DR/XObject/{holder form name}/Resources/XObject/{inner name} By default inner form name starts with "n". Then we add number of form to the name.- Returns:
- the inner form
-
setInnerForm
public void setInnerForm(PDFormXObject innerForm)
sets inner form to this location: AcroForm/DR/XObject/{holder form name}/Resources/XObject/{destination}- Parameters:
innerForm
-
-
getInnerFormName
public COSName getInnerFormName()
Gets name of inner form- Returns:
- the inner forms's name
-
setInnerFormName
public void setInnerFormName(COSName innerFormName)
Sets inner form name- Parameters:
innerFormName
-
-
getImageFormStream
public PDStream getImageFormStream()
Gets Image form stream- Returns:
- the image form's stream
-
setImageFormStream
public void setImageFormStream(PDStream imageFormStream)
Sets image form stream- Parameters:
imageFormStream
-
-
getImageFormResources
public PDResources getImageFormResources()
Gets image form resources- Returns:
- the image form's resources
-
setImageFormResources
public void setImageFormResources(PDResources imageFormResources)
Sets image form resource- Parameters:
imageFormResources
-
-
getImageForm
public PDFormXObject getImageForm()
Gets Image form. Image form is in this structure: /AcroForm/DR/{holder form}/Resources/XObject /{inner form} /Resources/XObject/{image form name}.- Returns:
- the image form
-
setImageForm
public void setImageForm(PDFormXObject imageForm)
Sets Image form. Image form will be in this structure: /AcroForm/DR/{holder form}/Resources/XObject /{inner form} /Resources/XObject/{image form name}. By default we start image form name with "img". Then we add number of image form to the form name. Sets image form- Parameters:
imageForm
-
-
getImageFormName
public COSName getImageFormName()
Gets image form name- Returns:
- the image form's name
-
setImageFormName
public void setImageFormName(COSName imageFormName)
Sets image form name- Parameters:
imageFormName
-
-
getImageName
public COSName getImageName()
Gets visible signature image name- Returns:
- the visible signature's image name
-
setImageName
public void setImageName(COSName imageName)
Sets visible signature image name- Parameters:
imageName
-
-
getVisualSignature
public COSDocument getVisualSignature()
Gets COSDocument of visible Signature.- Returns:
- the visual signature
- See Also:
COSDocument
-
setVisualSignature
public void setVisualSignature(COSDocument visualSignature)
Sets COSDocument of visible Signature.- Parameters:
visualSignature
-- See Also:
COSDocument
-
getAcroFormFields
public java.util.List<PDField> getAcroFormFields()
Gets acroFormFields- Returns:
- the AcroForm fields
-
setAcroFormFields
public void setAcroFormFields(java.util.List<PDField> acroFormFields)
Sets acroFormFields- Parameters:
acroFormFields
-
-
getTemplateAppearanceStream
@Deprecated public java.io.ByteArrayInputStream getTemplateAppearanceStream() throws java.io.IOException
Deprecated.This will be removed in 2.1 because the method name is misleading and confusing, and the work done rather belongs into the calling class:COSDocument visualSignature = structure.getVisualSignature(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); COSWriter writer = new COSWriter(baos); writer.write(visualSignature); writer.close(); structure.getTemplate().close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
Returns the visual signature COSDocument as a stream and closes the template field PDDocument.- Returns:
- the visual signature COSDocument as a stream
- Throws:
java.io.IOException
-
getWidgetDictionary
public COSDictionary getWidgetDictionary()
Gets Widget Dictionary.- Returns:
- the widget dictionary
-
setWidgetDictionary
public void setWidgetDictionary(COSDictionary widgetDictionary)
Sets Widget Dictionary.- Parameters:
widgetDictionary
-
-
-