Top Description Constructors Methods
org.apache.pdfbox.examples.pdmodel

public Class PrintDocumentMetaData

extends Object
Class Inheritance
Imports
org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, .PDDocumentCatalog, .PDDocumentInformation, org.apache.pdfbox.pdmodel.common.PDMetadata, java.io.File, .IOException, java.nio.charset.StandardCharsets, java.text.SimpleDateFormat, java.util.Calendar

This is an example on how to get a documents metadata information.
Author
Ben Litchfield

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String

Returns:

A string representation of the date.
formatDate
(Calendar
The date to format.
date
)

This will format a date object.

public static void
main(String[]
The command line arguments.
args
)

This will print the documents data.

public void
printMetadata(PDDocument
The document to get the metadata from.
document
)

This will print the documents data to System.out.

private static void
usage()

This will print the usage for this document.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PrintDocumentMetaDataback to summary
public PrintDocumentMetaData()

Method Detail

formatDateback to summary
private String formatDate(Calendar date)

This will format a date object.

Parameters
date:Calendar

The date to format.

Returns:String

A string representation of the date.

mainback to summary
public static void main(String[] args) throws IOException

This will print the documents data.

Parameters
args:String[]

The command line arguments.

Exceptions
IOException:
If there is an error parsing the document.
printMetadataback to summary
public void printMetadata(PDDocument document) throws IOException

This will print the documents data to System.out.

Parameters
document:PDDocument

The document to get the metadata from.

Exceptions
IOException:
If there is an error getting the page count.
usageback to summary
private static void usage()

This will print the usage for this document.