Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.digitalsignature

public Class SignatureOptions

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .File, .IOException, .InputStream, org.apache.pdfbox.cos.COSDocument, org.apache.pdfbox.io.RandomAccessReadBuffer, .RandomAccessReadBufferedFile, .RandomAccessRead, org.apache.pdfbox.pdfparser.PDFParser, org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigProperties

This contains the visual signature as a COSDocument, its preferred size and the page.

Field Summary

Modifier and TypeField and Description
public static final int
private int
private RandomAccessRead
private int
private COSDocument

Constructor Summary

AccessConstructor and Description
public
SignatureOptions()

Creates the default signature options.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes the visual signature COSDocument, if any.

public int

Returns:

the page number
getPage
()

Get the 0-based page number.

public int

Returns:

the preferred size of the signature in bytes.
getPreferredSignatureSize
()

Get the preferred size of the signature.

public COSDocument

Returns:

the visual signature
getVisualSignature
()

Get the visual signature.

private void
public void
setPage(int
the page number
pageNo
)

Set the 0-based page number.

public void
setPreferredSignatureSize(int
the size of the signature in bytes. Only values above 0 will be considered.
size
)

Set the preferred size of the signature.

public void
setVisualSignature(File
the file containing the visual signature
file
)

Reads the visual signature from the given file.

public void
setVisualSignature(InputStream
the input stream containing the visual signature
is
)

Reads the visual signature from the given input stream.

public void
setVisualSignature(PDVisibleSigProperties
the PDVisibleSigProperties object containing the visual signature
visSignatureProperties
)

Reads the visual signature from the given visual signature properties

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_SIGNATURE_SIZEback to summary
public static final int DEFAULT_SIGNATURE_SIZE
pageNoback to summary
private int pageNo
pdfSourceback to summary
private RandomAccessRead pdfSource
preferredSignatureSizeback to summary
private int preferredSignatureSize
visualSignatureback to summary
private COSDocument visualSignature

Constructor Detail

SignatureOptionsback to summary
public SignatureOptions()

Creates the default signature options.

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Closes the visual signature COSDocument, if any. Do not call this before you're saved your signed PDF document, or saving will fail because COSStream objects held both by the COSDocument and by the signed document would no longer be available.

Annotations
@Override
Exceptions
IOException:
if the document could not be closed
getPageback to summary
public int getPage()

Get the 0-based page number.

Returns:int

the page number

getPreferredSignatureSizeback to summary
public int getPreferredSignatureSize()

Get the preferred size of the signature.

Returns:int

the preferred size of the signature in bytes.

getVisualSignatureback to summary
public COSDocument getVisualSignature()

Get the visual signature.

Returns:COSDocument

the visual signature

initFromRandomAccessReadback to summary
private void initFromRandomAccessRead(RandomAccessRead rar) throws IOException
setPageback to summary
public void setPage(int pageNo)

Set the 0-based page number.

Parameters
pageNo:int

the page number

setPreferredSignatureSizeback to summary
public void setPreferredSignatureSize(int size)

Set the preferred size of the signature.

Parameters
size:int

the size of the signature in bytes. Only values above 0 will be considered.

setVisualSignatureback to summary
public void setVisualSignature(File file) throws IOException

Reads the visual signature from the given file.

Parameters
file:File

the file containing the visual signature

Exceptions
IOException:
when something went wrong during parsing
setVisualSignatureback to summary
public void setVisualSignature(InputStream is) throws IOException

Reads the visual signature from the given input stream.

Parameters
is:InputStream

the input stream containing the visual signature

Exceptions
IOException:
when something went wrong during parsing
setVisualSignatureback to summary
public void setVisualSignature(PDVisibleSigProperties visSignatureProperties) throws IOException

Reads the visual signature from the given visual signature properties

Parameters
visSignatureProperties:PDVisibleSigProperties

the PDVisibleSigProperties object containing the visual signature

Exceptions
IOException:
when something went wrong during parsing