Method from org.apache.pdfbox.pdmodel.PDDocumentCatalog Detail: |
public PDAcroForm getAcroForm() {
if( acroForm == null )
{
COSDictionary acroFormDic =
(COSDictionary)root.getDictionaryObject( COSName.ACRO_FORM );
if( acroFormDic != null )
{
acroForm = new PDAcroForm( document, acroFormDic );
}
}
return acroForm;
}
This will get the documents acroform. This will return null if
no acroform is part of the document. |
public PDDocumentCatalogAdditionalActions getActions() {
COSDictionary addAct = (COSDictionary) root.getDictionaryObject( COSName.AA );
if (addAct == null)
{
addAct = new COSDictionary();
root.setItem(COSName.AA, addAct);
}
return new PDDocumentCatalogAdditionalActions(addAct);
}
|
public List getAllPages() {
List retval = new ArrayList();
PDPageNode rootNode = getPages();
//old (slower):
//getPageObjects( rootNode, retval );
rootNode.getAllKids(retval);
return retval;
}
The PDF document contains a hierarchical structure of PDPageNode and PDPages, which
is mostly just a way to store this information. This method will return a flat list
of all PDPage objects in this document. |
public COSDictionary getCOSDictionary() {
return root;
}
Convert this standard java object to a COS object. |
public COSBase getCOSObject() {
return root;
}
Convert this standard java object to a COS object. |
public PDDocumentOutline getDocumentOutline() {
PDDocumentOutline retval = null;
COSDictionary dict = (COSDictionary)root.getDictionaryObject( COSName.OUTLINES );
if( dict != null )
{
retval = new PDDocumentOutline( dict );
}
return retval;
}
Get the outline associated with this document or null if it
does not exist. |
public String getLanguage() {
return root.getString( COSName.LANG );
}
The language for the document. |
public PDMarkInfo getMarkInfo() {
PDMarkInfo retval = null;
COSDictionary dic = (COSDictionary)root.getDictionaryObject( COSName.MARK_INFO );
if( dic != null )
{
retval = new PDMarkInfo( dic );
}
return retval;
}
Get info about doc's usage of tagged features. This will return
null if there is no information. |
public PDMetadata getMetadata() {
PDMetadata retval = null;
COSStream stream = (COSStream)root.getDictionaryObject( COSName.METADATA );
if( stream != null )
{
retval = new PDMetadata( stream );
}
return retval;
}
Get the metadata that is part of the document catalog. This will
return null if there is no meta data for this object. |
public PDDocumentNameDictionary getNames() {
PDDocumentNameDictionary nameDic = null;
COSDictionary names = (COSDictionary) root.getDictionaryObject(COSName.NAMES);
if(names != null)
{
nameDic = new PDDocumentNameDictionary(this,names);
}
return nameDic;
}
|
public PDDestinationOrAction getOpenAction() throws IOException {
PDDestinationOrAction action = null;
COSBase actionObj = root.getDictionaryObject(COSName.OPEN_ACTION);
if( actionObj == null )
{
//no op
}
else if( actionObj instanceof COSDictionary )
{
action = PDActionFactory.createAction((COSDictionary)actionObj);
}
else if( actionObj instanceof COSArray )
{
action = PDDestination.create( actionObj );
}
else
{
throw new IOException( "Unknown OpenAction " + actionObj );
}
return action;
}
Get the Document Open Action for this object. |
public PDPageLabels getPageLabels() throws IOException {
PDPageLabels labels = null;
COSDictionary dict = (COSDictionary) root.getDictionaryObject(COSName.PAGE_LABELS);
if (dict != null)
{
labels = new PDPageLabels(document, dict);
}
return labels;
}
Returns the page labels descriptor of the document. |
public String getPageLayout() {
return root.getNameAsString( COSName.PAGE_LAYOUT, PAGE_LAYOUT_SINGLE_PAGE );
}
Set the page layout, see the PAGE_LAYOUT_XXX constants. |
public String getPageMode() {
return root.getNameAsString( COSName.PAGE_MODE, PAGE_MODE_USE_NONE );
}
Set the page display mode, see the PAGE_MODE_XXX constants. |
public PDPageNode getPages() {
return new PDPageNode( (COSDictionary)root.getDictionaryObject( COSName.PAGES ) );
}
This will get the root node for the pages. |
public PDStructureTreeRoot getStructureTreeRoot() {
PDStructureTreeRoot treeRoot = null;
COSDictionary dic = (COSDictionary)root.getDictionaryObject( COSName.STRUCT_TREE_ROOT );
if( dic != null )
{
treeRoot = new PDStructureTreeRoot( dic );
}
return treeRoot;
}
Get the document's structure tree root. |
public List getThreads() {
COSArray array = (COSArray)root.getDictionaryObject( COSName.THREADS );
if( array == null )
{
array = new COSArray();
root.setItem( COSName.THREADS, array );
}
List pdObjects = new ArrayList();
for( int i=0; i< array.size(); i++ )
{
pdObjects.add( new PDThread( (COSDictionary)array.getObject( i ) ) );
}
return new COSArrayList( pdObjects, array );
}
Get the list threads for this pdf document. |
public PDURIDictionary getURI() {
PDURIDictionary retval = null;
COSDictionary uri = (COSDictionary)root.getDictionaryObject( COSName.URI );
if( uri != null )
{
retval = new PDURIDictionary( uri );
}
return retval;
}
Document level information in the URI. |
public PDViewerPreferences getViewerPreferences() {
PDViewerPreferences retval = null;
COSDictionary dict = (COSDictionary)root.getDictionaryObject( COSName.VIEWER_PREFERENCES );
if( dict != null )
{
retval = new PDViewerPreferences( dict );
}
return retval;
}
Get the viewer preferences associated with this document or null if they
do not exist. |
public void setAcroForm(PDAcroForm acro) {
root.setItem( COSName.ACRO_FORM, acro );
}
Set the acro form for this catalog. |
public void setActions(PDDocumentCatalogAdditionalActions actions) {
root.setItem(COSName.AA, actions );
}
Set the additional actions for the document. |
public void setDocumentOutline(PDDocumentOutline outlines) {
root.setItem( COSName.OUTLINES, outlines );
}
Set the document outlines. |
public void setLanguage(String language) {
root.setString( COSName.LANG, language );
}
Set the Language for the document. |
public void setMarkInfo(PDMarkInfo markInfo) {
root.setItem( COSName.MARK_INFO, markInfo );
}
Set information about the doc's usage of tagged features. |
public void setMetadata(PDMetadata meta) {
root.setItem( COSName.METADATA, meta );
}
Set the metadata for this object. This can be null. |
public void setNames(PDDocumentNameDictionary names) {
root.setItem(COSName.NAMES, names );
}
Set the names dictionary for the document. |
public void setOpenAction(PDDestinationOrAction action) {
root.setItem( COSName.OPEN_ACTION, action );
}
Set the Document Open Action for this object. |
public void setPageLabels(PDPageLabels labels) {
root.setItem(COSName.PAGE_LABELS, labels);
}
Set the page label descriptor for the document. |
public void setPageLayout(String layout) {
root.setName( COSName.PAGE_LAYOUT, layout );
}
Set the page layout. See the PAGE_LAYOUT_XXX constants for valid values. |
public void setPageMode(String mode) {
root.setName( COSName.PAGE_MODE, mode );
}
Set the page mode. See the PAGE_MODE_XXX constants for valid values. |
public void setStructureTreeRoot(PDStructureTreeRoot treeRoot) {
root.setItem( COSName.STRUCT_TREE_ROOT, treeRoot );
}
Set the document's structure tree root. |
public void setThreads(List threads) {
root.setItem( COSName.THREADS, COSArrayList.converterToCOSArray( threads ) );
}
Set the list of threads for this pdf document. |
public void setURI(PDURIDictionary uri) {
root.setItem( COSName.URI, uri );
}
Set the document level uri. |
public void setViewerPreferences(PDViewerPreferences prefs) {
root.setItem( COSName.VIEWER_PREFERENCES, prefs );
}
Set the viewer preferences. |