public class PDFDoc extends Doc
The class offers a number of entry points into the document. For example:
The class also offers utility methods to slit and merge PDF pages, to create new pages, to flatten forms, to change security settings, etc.
Modifier and Type | Field and Description |
---|---|
static int |
e_action_trigger_doc_did_print
Triggered after printing a document
|
static int |
e_action_trigger_doc_did_save
Triggered after saving a document
|
static int |
e_action_trigger_doc_will_close
Triggered before closing a document
|
static int |
e_action_trigger_doc_will_print
Triggered before printing a document
|
static int |
e_action_trigger_doc_will_save
Triggered before saving a document
|
static int |
e_annots_only |
static int |
e_both |
static int |
e_flatten_all |
static int |
e_flatten_annots_only |
static int |
e_flatten_forms_only |
static int |
e_flatten_link_only |
static int |
e_forms_only |
static int |
e_insert_bookmark |
static int |
e_none |
Constructor and Description |
---|
PDFDoc()
Default constructor.
|
PDFDoc(byte[] buf)
Open a SDF/Cos document from a memory buffer.
|
PDFDoc(Filter stream)
Open an existing PDF document.
|
PDFDoc(java.io.InputStream stream)
Open an existing PDF document from an InputStream.
|
PDFDoc(java.io.InputStream stream,
int size)
Open an existing PDF document from an InputStream.
|
PDFDoc(SDFDoc sdfdoc)
Create a PDF document from an existing SDF/Cos document.
|
PDFDoc(java.lang.String filepath)
Open an existing PDF document.
|
Modifier and Type | Method and Description |
---|---|
static PDFDoc |
__Create(long impl) |
long |
__GetHandle() |
void |
addFileAttachment(java.lang.String file_key,
FileSpec embedded_file)
Associates a file attachment with the document.
|
void |
addHighlights(java.lang.String hilite)
AddHighlights is used to highlight text in a document using 'Adobe's
Highlight File Format' (Technical Note #5172 ).
|
void |
addRootBookmark(Bookmark root_bookmark)
Adds/links the specified Bookmark to the root level of document's outline
tree.
|
long |
addSignatureHandler(SignatureHandler signature_handler)
Adds a signature handler to the signature manager.
|
long |
addStdSignatureHandler(byte[] pkcs12_keybuffer,
java.lang.String pkcs12_keypass)
Adds a standard (built-in) signature handler to the signature manager.
|
long |
addStdSignatureHandler(java.lang.String pkcs12_keyfile,
java.lang.String pkcs12_keypass)
Adds a standard (built-in) signature handler to the signature manager.
|
void |
close()
Destructor.
|
Obj |
createIndirectArray()
Create the indirect array.
|
Obj |
createIndirectBool(boolean value)
Create the indirect boolean.
|
Obj |
createIndirectDict()
Create the indirect dictionary
|
Obj |
createIndirectName(java.lang.String name)
Create SDF/Cos indirect name
Unlike direct objects, indirect objects can be referenced by more than
one object (i.e.
|
Obj |
createIndirectNull()
Create the indirect null.
|
Obj |
createIndirectNumber(double value)
Create the indirect number.
|
Obj |
createIndirectStream(byte[] data)
Create the indirect stream.
|
Obj |
createIndirectStream(byte[] data,
Filter filter_chain)
Create the indirect stream.
|
Obj |
createIndirectStream(FilterReader data)
Create the indirect stream.
|
Obj |
createIndirectStream(FilterReader data,
Filter filter_chain)
Create the indirect stream.
|
Obj |
createIndirectString(byte[] value)
Create the indirect string from buffer
|
Obj |
createIndirectString(java.lang.String str)
Create the indirect string.
|
FDFDoc |
fdfExtract()
Extract form data to FDF
|
FDFDoc |
fdfExtract(Annot[] annotations)
Extract annotations to FDF
|
FDFDoc |
fdfExtract(int extractFlag)
Extract form data and/or annotations to FDF
|
void |
fdfMerge(FDFDoc fdf_doc)
Import form data from FDF file to PDF interactive form.
|
Field |
fieldCreate(java.lang.String field_name,
int type)
Create a new interactive form Field.
|
Field |
fieldCreate(java.lang.String field_name,
int type,
Obj field_value)
Create a new interactive form field
|
Field |
fieldCreate(java.lang.String field_name,
int type,
Obj field_value,
Obj def_field_value)
Create a new interactive form field
|
Field |
fieldCreate(java.lang.String field_name,
int type,
java.lang.String field_value)
Create a new interactive form field
|
Field |
fieldCreate(java.lang.String field_name,
int type,
java.lang.String field_value,
java.lang.String def_field_value)
Create a new interactive form field
|
void |
flattenAnnotations() |
void |
flattenAnnotations(boolean forms_only)
Flatten all annotations in the document.
|
void |
flattenAnnotationsAdvanced(long flags)
Flatten annotations/forms/links in the document.
|
void |
generateThumbnails(long size)
Generates thumbnail images for all the pages in this PDF document.
|
Obj |
getAcroForm()
Get the AcroForm Dictionary.
|
PDFDocInfo |
getDocInfo()
Get the document infomation
|
Field |
getField(java.lang.String field_name)
Get the specified field from field name
|
FieldIterator |
getFieldIterator()
An interactive form (sometimes referred to as an AcroForm) is a
collection of fields for gathering information interactively from the
user.
|
FieldIterator |
getFieldIterator(java.lang.String field_name)
Get specified FieldIterator from field name
|
java.lang.String |
getFileName()
Get the file name.
|
Bookmark |
getFirstBookmark()
Get the first bookmark.
|
Config |
getOCGConfig()
Get the optional group configuration
|
Obj |
getOCGs()
Get the optional content groups
|
Action |
getOpenAction()
Get the open action.
|
Page |
getPage(int page_number)
Get the page object from given page number
|
int |
getPageCount()
Get the page count.
|
PageIterator |
getPageIterator()
Get the page iterator.
|
PageIterator |
getPageIterator(int page_number)
Get the page iterator from given page number
|
PageLabel |
getPageLabel(int page_num)
Get the specified page label
|
Obj |
getPages()
Get the pages.
|
Obj |
getRoot()
Get the root of the document
|
SDFDoc |
getSDFDoc()
Get the underlying SDFDoc object.
|
SecurityHandler |
getSecurityHandler()
Get the security handler.
|
SignatureHandler |
getSignatureHandler(long signature_handler_id)
Gets the associated signature handler instance from the signature manager by looking it up with the handler name.
|
STree |
getStructTree()
Get the structure tree root
|
Obj |
getTrailer()
Get the document's trailer.
|
Obj |
getTriggerAction(int trigger)
Get the Action associated with the selected PDFDoc Trigger event.
|
PDFDocViewPrefs |
getViewPrefs()
Get the view preferences
|
boolean |
hasOC()
Checks for optional content
|
boolean |
hasRepairedXRef()
Checks whether or not the underlying file has an XRef table that had to be repaired
when the file was opened.
|
boolean |
hasSignatures()
Indicates whether this documents contains any digital signatures.
|
Page[] |
importPages(Page[] pages)
The function imports a list of pages to this documents.
|
Page[] |
importPages(Page[] pages,
boolean import_bookmarks)
Import given pages into current PDFDoc
|
boolean |
initSecurityHandler()
Initializes document's SecurityHandler.
|
boolean |
initSecurityHandler(java.lang.Object custom_data)
Initialize the security handler.
|
boolean |
initStdSecurityHandler(byte[] passwordBuffer)
Initializes document's SecurityHandler using the supplied password.
|
boolean |
initStdSecurityHandler(java.lang.String password)
Initializes document's SecurityHandler using the supplied password.
|
void |
insertPages(int insertBeforeThisPage,
PDFDoc sourceDoc,
int startPage,
int endPage,
int insertFlag,
ProgressMonitor monitor)
Inserts a range of pages from specified PDFDoc
|
void |
insertPages(int insertBeforeThisPage,
PDFDoc sourceDoc,
PageSet sourcePageSet,
int insertFlag,
ProgressMonitor monitor)
Inserts a range of pages from specified PDFDoc using PageSet
|
boolean |
isEncrypted()
Checks if PDFDoc is encrypted.
|
boolean |
isLinearized()
Call this function to determine whether the document is represented in
linearized (fast web view) format.
|
boolean |
isModified()
Call this function to determine whether the document has been modified
since it was last saved.
|
boolean |
isTagged()
Checks if current document is tagged.
|
void |
lock()
Locks the document to prevent competing threads from accessiong the
document at the same time.
|
void |
lockRead()
Locks the document to prevent competing write threads (using lock()) from accessing the document
at the same time.
|
void |
movePages(int moveBeforeThisPage,
PDFDoc sourceDoc,
int startPage,
int endPage,
int insertFlag,
ProgressMonitor monitor)
Moves a range of pages from specified PDFDoc.
|
void |
movePages(int moveBeforeThisPage,
PDFDoc sourceDoc,
PageSet sourcePageSet,
int insertFlag,
ProgressMonitor monitor)
Moves a range of pages from specified PDFDoc.
|
Page |
pageCreate()
Create a new, empty page in the document.
|
Page |
pageCreate(Rect media_box)
Create page with given media box
|
void |
pageInsert(PageIterator where,
Page page)
Insert/Import a single page at a specific location in the page sequence.
|
void |
pagePushBack(Page page)
Adds a page to the end of a documents's page sequence.
|
void |
pagePushFront(Page page)
Adds a page to the beginning of a documents's page sequence.
|
void |
pageRemove(PageIterator page_itr)
Remove specified page
|
void |
refreshFieldAppearances()
Regenerates the appearance stream for every widget annotation in the
document Call this method if you modified field's value and would like to
update field's appearances.
|
void |
removePageLabel(int page_num)
Removes the page label that is attached to the specified page,
effectively merging the specified range with the previous page label
sequence.
|
void |
removeSecurity()
Removes all security for the document.
|
void |
removeSignatureHandler(long signature_handler_id)
Removes a signature handler from the signature manager.
|
void |
save(Filter output_filter,
long flags)
Saves the document to a CustomFilter.
|
byte[] |
save(long flags,
ProgressMonitor progress)
Saves the document to a memory buffer.
|
void |
save(java.io.OutputStream stream,
long flags,
ProgressMonitor progress)
Saves the document to an OutputStream.
|
void |
save(java.io.OutputStream stream,
long flags,
ProgressMonitor progress,
int size)
Saves the document to an OutputStream.
|
void |
save(java.lang.String path,
long flags,
ProgressMonitor progress)
Saves the document to a file.
|
void |
setOpenAction(Action action)
Set the Action that will be triggered when the document is opened.
|
void |
setPageLabel(int page_num,
PageLabel label)
Attaches a label to a page.
|
void |
setSecurityHandler(SecurityHandler handler)
The function sets a new SecurityHandler as the current security handler.
|
boolean |
timedLock(int milliseconds)
Try locking the document, waiting no longer than specified number of
milliseconds.
|
boolean |
timedLockRead(int milliseconds)
Tries to obtain a read lock the document for milliseconds duration, and returns
true if the lock was successfully acquired
|
boolean |
tryLock()
Try locking the document in non-blocking manner.
|
boolean |
tryLockRead()
Try obtaining a read lock on the document in non-blocking manner.
|
void |
unlock()
Unlock the document.
|
void |
unlockRead()
Removes the read lock from the document.
|
public static final int e_none
public static final int e_insert_bookmark
public static final int e_forms_only
public static final int e_annots_only
public static final int e_both
public static final int e_flatten_forms_only
public static final int e_flatten_annots_only
public static final int e_flatten_link_only
public static final int e_flatten_all
public static final int e_action_trigger_doc_will_close
public static final int e_action_trigger_doc_will_save
public static final int e_action_trigger_doc_did_save
public static final int e_action_trigger_doc_will_print
public static final int e_action_trigger_doc_did_print
public PDFDoc() throws PDFNetException
PDFNetException
public PDFDoc(SDFDoc sdfdoc) throws PDFNetException
Note: the SDFDoc will become invalid. If you would like to access the low level document use GetSDFDoc
sdfdoc
- a pointer to the SDF document. Created PDFDoc will take the
ownership of the low-level document.PDFNetException
public PDFDoc(java.lang.String filepath) throws PDFNetException
Note: Make sure to call InitSecurityHandler() after PDFDoc(...) in case a document is encrypted
filepath
- - pathname to the file.PDFNetException
public PDFDoc(Filter stream) throws PDFNetException
Note: if the input stream doesn't support Seek() operation the document will load whole data stream in memory before parsing. In case of linearized PDF, the document may be parsed on-the-fly while it is being loaded in memory. Note that since StdFile implements Seek() interface, the document does not have to be fully in memory before it is used.
Note: Make sure to call InitSecurityHandler() after PDFDoc(...) for encrypted documents.
stream
- - input stream containing a serialized document. The input
stream may be a random-access file, memory buffer, slow HTTP
connection etc.PDFNetException
public PDFDoc(byte[] buf) throws PDFNetException
Note: the document should be fully loaded in the memory buffer.
buf
- - a memory buffer containing the serialized documentPDFNetException
public PDFDoc(java.io.InputStream stream) throws PDFNetException, java.io.IOException
Note: Make sure to call InitSecurityHandler() after FDFDoc(...) for encrypted documents.
stream
- - input stream containing a serialized document.PDFNetException
java.io.IOException
- Signals that an I/O exception has occurred.public PDFDoc(java.io.InputStream stream, int size) throws PDFNetException, java.io.IOException
Note: Make sure to call InitSecurityHandler() after FDFDoc(...) for encrypted documents.
stream
- - input stream containing a serialized document.size
- - the expected size of the input stream.PDFNetException
java.io.IOException
- Signals that an I/O exception has occurred.public void close() throws PDFNetException
PDFNetException
public Obj getTriggerAction(int trigger) throws PDFNetException
trigger
- the type of trigger event to getPDFNetException
public boolean isEncrypted() throws PDFNetException
PDFNetException
public boolean initSecurityHandler() throws PDFNetException
PDFNetException
public boolean initSecurityHandler(java.lang.Object custom_data) throws PDFNetException
custom_data
- specify custom data that should be passed in
SecurityHandler::Initialize() callback.PDFNetException
public boolean initStdSecurityHandler(java.lang.String password) throws PDFNetException
password
- Specifies the password used to open the document without any
user feedback. If you would like to dynamically obtain the
password, you need to derive a custom class from
StdSecurityHandler() and use InitSecurityHandler() without any
parameters. See EncTest sample for example code.PDFNetException
public boolean initStdSecurityHandler(byte[] passwordBuffer) throws PDFNetException
passwordBuffer
- Specifies the password used to open the document without any
user feedback. If you would like to dynamically obtain the
password, you need to derive a custom class from
StdSecurityHandler() and use InitSecurityHandler() without any
parameters. See EncTest sample for example code.PDFNetException
public SecurityHandler getSecurityHandler()
Note: InitSecurityHandler() should be called before GetSecurityHandler() in order to initialize the handler.
Note: Returned security handler can be modified in order to change the security settings of the existing document. Changes to the current handler will not invalidate the access to the original file and will take effect during document Save().
Note: If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method.
public void setSecurityHandler(SecurityHandler handler)
Note: Setting a new security handler will not invalidate the access to the original file and will take effect during document Save().
Note: If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method.
handler
- the new security handlerpublic PDFDocInfo getDocInfo() throws PDFNetException
PDFNetException
public PDFDocViewPrefs getViewPrefs() throws PDFNetException
PDFNetException
public boolean isModified() throws PDFNetException
PDFNetException
public boolean hasRepairedXRef() throws PDFNetException
PDFNetException
public boolean isLinearized() throws PDFNetException
Note: Any changes to the document can invalidate linearization. The function will return 'true' only if the original document is linearized and if it is not modified.
In order to provide good performance over relatively slow communication links, PDFNet can generate PDF documents with linearized objects and hint tables that can allow a PDF viewer application to download and view one page of a PDF file at a time, rather than requiring the entire file (including fonts and images) to be downloaded before any of it can be viewed.
To save a document in linearized (fast web view) format you only
need to pass SDFDoc.e_linearized
flag in the Save.
method.
PDFNetException
public void save(java.lang.String path, long flags, ProgressMonitor progress) throws PDFNetException
Note: In a multi-threaded environment, the user is expected to acquire a write lock before attempting to save the document.
Note: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.
Note: - If the original pdf has a corrupt xref table (see HasRepairedXref or pdftron.com/kb_corrupt_xref), then it can not be saved using the e_incremental flag.
path
- - The full path name to which the file is saved.flags
- - A bit field composed of an OR of the following values:
progress
- - A pointer to the progress interface. NULL if progress
tracking is not required.PDFNetException
public byte[] save(long flags, ProgressMonitor progress) throws PDFNetException
Note: This method ignores e_incremental flag.
Note: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.
flags
- - A bit field composed of an OR of the following values:
progress
- - A pointer to the progress interface. NULL if progress
tracking is not required.PDFNetException
public void save(java.io.OutputStream stream, long flags, ProgressMonitor progress) throws PDFNetException, java.io.IOException
Note: This method ignores e_incremental flag.
Note: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.
stream
- An OutputStream where the document should be serialized.flags
- - A bit field composed of an OR of the following values:
progress
- - A pointer to the progress interface. NULL if progress
tracking is not required.PDFNetException
java.io.IOException
- Signals that an I/O exception has occurred.public void save(java.io.OutputStream stream, long flags, ProgressMonitor progress, int size) throws PDFNetException, java.io.IOException
Note: This method ignores e_incremental flag.
Note: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.
stream
- An OutputStream where the document should be serialized.flags
- - A bit field composed of an OR of the following values:
progress
- - A pointer to the progress interface. NULL if progress
tracking is not required.size
- The expected size of the output stream.PDFNetException
java.io.IOException
- Signals that an I/O exception has occurred.public void save(Filter output_filter, long flags) throws PDFNetException, java.io.IOException
Note: This method ignores e_incremental flag. Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.
output_filter
- A output_filter filter where the document should be saved to.flags
- - A bit field composed of an OR of the following values:
PDFNetException
java.io.IOException
- Signals that an I/O exception has occurred.public PageIterator getPageIterator() throws PDFNetException
PDFNetException
- PageIterator itr = pdfdoc.getPageIterator(); while (itr.hasNext())
{ // Read every page Page page = itr.current(); // ... itr.next() }
For full sample code, please take a look at ElementReader,
PDFPageTest and PDFDraw sample projects.
public PageIterator getPageIterator(int page_number) throws PDFNetException
page_number
- the input page numberPDFNetException
public Page getPage(int page_number) throws PDFNetException
page_number
- - the page number in document's page sequence. Page numbers in
document's page sequence are indexed from 1.PDFNetException
- Page page = pdfdoc.GetPage(page_num); if (page == null) return; //
Page not found
public void pageRemove(PageIterator page_itr) throws PDFNetException
page_itr
- - the PageIterator to the page that should be removed A
PageIterator for the given page can be obtained using
PDFDoc::Find(page_num) or using direct iteration through
document's page sequence.PDFNetException
public void pageInsert(PageIterator where, Page page) throws PDFNetException
Note: Invalidates all PageIterators pointing to the document.
where
- - The location in the page sequence indicating where to insert
the page. The page is inserted before the specified location.page
- - A page to insert.PDFNetException
public void insertPages(int insertBeforeThisPage, PDFDoc sourceDoc, int startPage, int endPage, int insertFlag, ProgressMonitor monitor) throws PDFNetException
insertBeforeThisPage
- the destination of the insertion. If less than or equal to 1, the
pages are added to the beginning of the document. If larger than
the number of pages in the destination document, the pages are appended
to the document.sourceDoc
- source PDFDoc to insert fromstartPage
- start of the page number to insertendPage
- end of the page number to insertinsertFlag
- specifies insert optionsmonitor
- A pointer to the progress interface. NULL if progress tracking
is not required.PDFNetException
public void insertPages(int insertBeforeThisPage, PDFDoc sourceDoc, PageSet sourcePageSet, int insertFlag, ProgressMonitor monitor) throws PDFNetException
insertBeforeThisPage
- the destination of the insertion. If less than or equal to 1, the
pages are added to the beginning of the document. If larger than
the number of pages in the destination document, the pages are appended
to the document.sourceDoc
- source PDFDoc to insert fromsourcePageSet
- a collection of the page number to insertinsertFlag
- specifies insert optionsmonitor
- A pointer to the progress interface. NULL if progress tracking
is not required.PDFNetException
public void movePages(int moveBeforeThisPage, PDFDoc sourceDoc, int startPage, int endPage, int insertFlag, ProgressMonitor monitor) throws PDFNetException
Note: MovePages function does not save sourceDoc. It merely delete pages in memory. For permanent changes, PDFDoc::Save should be used to save sourceDoc after function exists.
moveBeforeThisPage
- the destination of the move. If less than or equal to 1, the
pages are moved to the beginning of the document. If larger than
the number of pages in the destination document, the pages are moved
to the end of document.sourceDoc
- source PDFDoc to move fromstartPage
- start of the page number to moveendPage
- end of the page number to moveinsertFlag
- specifies insert optionsmonitor
- A pointer to the progress interface. NULL if progress tracking
is not required.PDFNetException
public void movePages(int moveBeforeThisPage, PDFDoc sourceDoc, PageSet sourcePageSet, int insertFlag, ProgressMonitor monitor) throws PDFNetException
Note: MovePages function does not save sourceDoc. It merely delete pages in memory. For permanent changes, PDFDoc::Save should be used to save sourceDoc after function exists.
moveBeforeThisPage
- the destination of the move. If less than or equal to 1, the
pages are moved to the beginning of the document. If larger than
the number of pages in the destination document, the pages are moved
to the end of document.sourceDoc
- source PDFDoc to move fromsourcePageSet
- a collection of the page number to moveinsertFlag
- specifies insert optionsmonitor
- A pointer to the progress interface. NULL if progress tracking
is not required.PDFNetException
public void pagePushFront(Page page) throws PDFNetException
page
- - a page to prepend to the document Invalidates all
PageIterators pointing to the document.PDFNetException
public void pagePushBack(Page page) throws PDFNetException
Note: Invalidates all PageIterators pointing to the document.
page
- - a page to append to the documentPDFNetException
public Page[] importPages(Page[] pages) throws PDFNetException
pages
- A list of pages to import. All pages should belong to the same
source document.PDFNetException
public Page[] importPages(Page[] pages, boolean import_bookmarks) throws PDFNetException
pages
- pages to importimport_bookmarks
- whether to import bookmarksPDFNetException
public Page pageCreate() throws PDFNetException
Note: the new page still does not belong to document page sequence and should be subsequently placed at a specific location within the sequence.
PDFNetException
public Page pageCreate(Rect media_box) throws PDFNetException
media_box
- the input media boxPDFNetException
public Bookmark getFirstBookmark() throws PDFNetException
PDFNetException
public void addRootBookmark(Bookmark root_bookmark) throws PDFNetException
root_bookmark
- root bookmark. It must not be linked (must not be belong) to a
bookmark tree.PDFNetException
public Obj getTrailer() throws PDFNetException
PDFNetException
public Obj getRoot() throws PDFNetException
PDFNetException
public Obj getPages() throws PDFNetException
PDFNetException
public int getPageCount() throws PDFNetException
PDFNetException
public FieldIterator getFieldIterator() throws PDFNetException
PDFNetException
- FieldIterator itr = pdfdoc.getFieldIterator(); for(; itr.hasNext();
itr.next()) { Field field = itr.current(); string s =
field.getName(); } //For a full sample, please refer to
'InteractiveForms' sample project.
public FieldIterator getFieldIterator(java.lang.String field_name) throws PDFNetException
field_name
- - name of the field (e.g. "employee.name.first").PDFNetException
- FieldIterator itr = pdfdoc.fieldFind("name"); if (itr.hasNext()) {
string name = itr.current().getName()); } else { ...field was not
found... }
public Field getField(java.lang.String field_name) throws PDFNetException
field_name
- - name of the field (e.g. "employee.name.first").PDFNetException
public Field fieldCreate(java.lang.String field_name, int type) throws PDFNetException
field_name
- name of the field (e.g. "employee.name.first"). field_name
must be either a unique name or equal to an existing terminal
field name.type
- field type (e.g. Field::e_text, Field::e_button, etc.)PDFNetException
public Field fieldCreate(java.lang.String field_name, int type, Obj field_value) throws PDFNetException
field_name
- name of the field (e.g. "employee.name.first"). field_name
must be either a unique name or equal to an existing terminal
field name.type
- field type (e.g. Field::e_text, Field::e_button, etc.)field_value
- PDFNetException
public Field fieldCreate(java.lang.String field_name, int type, Obj field_value, Obj def_field_value) throws PDFNetException
field_name
- name of the field (e.g. "employee.name.first"). field_name
must be either a unique name or equal to an existing terminal
field name.type
- field type (e.g. Field::e_text, Field::e_button, etc.)field_value
- def_field_value
- PDFNetException
public Field fieldCreate(java.lang.String field_name, int type, java.lang.String field_value, java.lang.String def_field_value) throws PDFNetException
field_name
- name of the field (e.g. "employee.name.first"). field_name
must be either a unique name or equal to an existing terminal
field name.type
- field type (e.g. Field::e_text, Field::e_button, etc.)field_value
- def_field_value
- PDFNetException
public Field fieldCreate(java.lang.String field_name, int type, java.lang.String field_value) throws PDFNetException
field_name
- name of the field (e.g. "employee.name.first"). field_name
must be either a unique name or equal to an existing terminal
field name.type
- field type (e.g. Field::e_text, Field::e_button, etc.)field_value
- PDFNetException
public void refreshFieldAppearances() throws PDFNetException
PDFNetException
public void flattenAnnotations(boolean forms_only) throws PDFNetException
forms_only
- if false flatten all annotations, otherwise flatten
only form fields.PDFNetException
public void flattenAnnotations() throws PDFNetException
PDFNetException
public void flattenAnnotationsAdvanced(long flags) throws PDFNetException
flags
- - A bit field composed of an OR of the following values:
PDFNetException
public Obj getAcroForm() throws PDFNetException
PDFNetException
public FDFDoc fdfExtract() throws PDFNetException
PDFNetException
public FDFDoc fdfExtract(int extractFlag) throws PDFNetException
extractFlag
- specifies extract optionsPDFNetException
public FDFDoc fdfExtract(Annot[] annotations) throws PDFNetException
annotations
- specifies the array of annotationsPDFNetException
public void fdfMerge(FDFDoc fdf_doc) throws PDFNetException
fdf_doc
- - a pointer to the FDF filePDFNetException
public Action getOpenAction() throws PDFNetException
Note: if the document does not nave associated action the returned Action will be null (i.e. Action.IsValid() returns false)
PDFNetException
public void setOpenAction(Action action) throws PDFNetException
action
- A new Action that will be triggered when the document is
opened. An example of such action is a GoTo Action that takes
the user to a given location in the document.PDFNetException
public void addFileAttachment(java.lang.String file_key, FileSpec embedded_file) throws PDFNetException
Note: Another way to associate a file attachment with the document is using SDF::NameTree: {@code SDF.NameTree names = SDF.NameTree.Create(doc, "EmbeddedFiles"); names.put(file_key, file_keysz, embedded_file.GetSDFObj());
file_key
- A key/name under which the attachment will be stored.embedded_file
- the embedded filePDFNetException
- }public PageLabel getPageLabel(int page_num) throws PDFNetException
page_num
- The page number. Because PDFNet indexes pages starting from 1,
page_num must be larger than 0.PDFNetException
public void setPageLabel(int page_num, PageLabel label) throws PDFNetException
page_num
- The number of the page to label. If page_num is less than 1 or
greater than the number of pages in the document, the method
does nothing.label
- page label input PageLabelPDFNetException
public void removePageLabel(int page_num) throws PDFNetException
page_num
- The page from which the page label is removed. Because PDFNet
indexes pages starting from 1, page_num must be larger than 0.PDFNetException
public STree getStructTree() throws PDFNetException
PDFNetException
public boolean hasOC() throws PDFNetException
PDFNetException
public Obj getOCGs() throws PDFNetException
PDFNetException
public Config getOCGConfig() throws PDFNetException
PDFNetException
public Obj createIndirectName(java.lang.String name) throws PDFNetException
name
- PDFNetException
public Obj createIndirectArray() throws PDFNetException
PDFNetException
public Obj createIndirectBool(boolean value) throws PDFNetException
value
- PDFNetException
public Obj createIndirectDict() throws PDFNetException
PDFNetException
public Obj createIndirectNull() throws PDFNetException
PDFNetException
public Obj createIndirectNumber(double value) throws PDFNetException
value
- PDFNetException
public Obj createIndirectString(byte[] value) throws PDFNetException
value
- input bufferPDFNetException
public Obj createIndirectString(java.lang.String str) throws PDFNetException
str
- value of the indirect stringPDFNetException
public Obj createIndirectStream(FilterReader data) throws PDFNetException
data
- PDFNetException
public Obj createIndirectStream(FilterReader data, Filter filter_chain) throws PDFNetException
data
- filter_chain
- PDFNetException
public Obj createIndirectStream(byte[] data) throws PDFNetException
data
- PDFNetException
public Obj createIndirectStream(byte[] data, Filter filter_chain) throws PDFNetException
data
- filter_chain
- PDFNetException
public SDFDoc getSDFDoc()
public void lock() throws PDFNetException
PDFNetException
public void unlock() throws PDFNetException
PDFNetException
public boolean tryLock() throws PDFNetException
PDFNetException
public boolean timedLock(int milliseconds) throws PDFNetException
milliseconds
- maximum time to waitPDFNetException
public void lockRead() throws PDFNetException
PDFNetException
public void unlockRead() throws PDFNetException
PDFNetException
public boolean tryLockRead() throws PDFNetException
PDFNetException
public boolean timedLockRead(int milliseconds) throws PDFNetException
milliseconds
- maximum time to waitPDFNetException
public java.lang.String getFileName() throws PDFNetException
PDFNetException
public void generateThumbnails(long size) throws PDFNetException
size
- The maximum dimension (width or height) that thumbnails will have.PDFNetException
public void removeSecurity()
public void addHighlights(java.lang.String hilite)
hilite
- filename for the highlight file or a data buffer containing
XML data.public boolean isTagged()
public boolean hasSignatures()
public long addSignatureHandler(SignatureHandler signature_handler) throws PDFNetException
signature_handler
- The signature handler instance to add to the signature manager.PDFNetException
public long addStdSignatureHandler(java.lang.String pkcs12_keyfile, java.lang.String pkcs12_keypass) throws PDFNetException
pkcs12_keyfile
- The private key certificate store to use.pkcs12_keypass
- The passphrase for the provided private key.PDFNetException
public long addStdSignatureHandler(byte[] pkcs12_keybuffer, java.lang.String pkcs12_keypass) throws PDFNetException
pkcs12_keybuffer
- The private key certificate store to use. (As an array of bytes).pkcs12_keypass
- The passphrase for the provided private key.PDFNetException
public void removeSignatureHandler(long signature_handler_id) throws PDFNetException
signature_handler_id
- The unique id of the signature handler to remove.PDFNetException
public SignatureHandler getSignatureHandler(long signature_handler_id) throws PDFNetException
signature_handler_id
- The name of the signature handler to get.PDFNetException
public static PDFDoc __Create(long impl)
public long __GetHandle()
__GetHandle
in class Doc