|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.digisigner.api.PdfDocument
public class PdfDocument
The PdfDocument
class represents your PDF document and provides methods to digitally sign it.
This class is the the entry point of the library.
The following code sample demonstrates how to create a simple visible signature in your document:
// specify document to sign
PdfDocument pdfDocument = new PdfDocument("sample.pdf");
// specify key in the key store
SigningData signingData = SigningData.fromPkcs12File("keystore.pfx", "keystore_pass", "key_alias");
// specify rectangle for the signature
signingData.setFieldRectangle(new Rectangle2D.Float(275, 50, 300, 100));
// sign document
pdfDocument.signDocument(signingData, "sample(signed).pdf");
Constructor Summary | |
---|---|
PdfDocument(byte[] pdfContent)
Creates a PdfDocument object from a byte array with the content of the pdf document. |
|
PdfDocument(File pdfFile)
Creates a PdfDocument object from a File object. |
|
PdfDocument(InputStream pdfInputStream)
Creates a PdfDocument object from an InputStream . |
|
PdfDocument(String pdfFilename)
Creates a PdfDocument object from a file specified by name. |
|
PdfDocument(URL pdfUrl)
Creates a PdfDocument object from a URL . |
Method Summary | |
---|---|
String |
getPassword()
Returns the password of the PDF document. |
void |
setPassword(String password)
Sets the password of the document. |
SignatureFieldData |
signDocument(SigningData signingData,
OutputStream signedPdfOutputStream)
Digitally signs the document and saves the signed result in the specified OutputStream . |
SignatureFieldData |
signDocument(SigningData signingData,
String signedPdfFilename)
Digitally signs the document and saves the signed result in the specified file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PdfDocument(File pdfFile)
PdfDocument
object from a File
object.
pdfFile
- PDF filepublic PdfDocument(String pdfFilename)
PdfDocument
object from a file specified by name.
pdfFilename
- PDF file namepublic PdfDocument(byte[] pdfContent)
PdfDocument
object from a byte array with the content of the pdf document.
pdfContent
- PDF document contentpublic PdfDocument(InputStream pdfInputStream)
PdfDocument
object from an InputStream
.
pdfInputStream
- input stream to read the PDF document contentpublic PdfDocument(URL pdfUrl)
PdfDocument
object from a URL
.
pdfUrl
- location of the PDF document contentMethod Detail |
---|
public String getPassword()
setPassword
method. It doesn't try to find out the real document password.
public void setPassword(String password)
password
- of the PDF documentpublic SignatureFieldData signDocument(SigningData signingData, String signedPdfFilename)
signingData
- data required to sign the documentsignedPdfFilename
- name of the signed PDF file
TimeStampException
- if cannot retrieve or parse time stamp information
CrlRetrievalException
- if cannot retrieve or parse certificate revocation lists
OcspCheckException
- if cannot retrieve or parse OCSP response
DigiRuntimeException
- if general problem occurspublic SignatureFieldData signDocument(SigningData signingData, OutputStream signedPdfOutputStream)
OutputStream
.
signingData
- data required to sign the documentsignedPdfOutputStream
- output stream for the signed PDF document
TimeStampException
- if cannot retrieve or parse time stamp information
CrlRetrievalException
- if cannot retrieve or parse certificate revocation lists
OcspCheckException
- if cannot retrieve or parse OCSP response
DigiRuntimeException
- if general problem occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |