if (props.isEmpty())
{
// The pdf doesn't contain any XMP metadata or XMP metadata do not contains any
// usefull data, try to use the document information instead
PDDocumentInformation docInfo = pdDocument.getDocumentInformation();
if (docInfo != null)
{
try
{
if (docInfo.getCreationDate() != null)
props.put(DCMetaData.DATE, docInfo.getCreationDate());
}
catch (Exception e)
{
log.warn("getCreationDate failed: " + e);
}
try
{
if (docInfo.getCreator() != null)
props.put(DCMetaData.CREATOR, docInfo.getCreator());
}
catch (Exception e)
{
log.warn("getCreator failed: " + e);
}
try
{
if (docInfo.getKeywords() != null)
props.put(DCMetaData.SUBJECT, docInfo.getKeywords());
}
catch (Exception e)
{
log.warn("getKeywords failed: " + e);
}
try
{
if (docInfo.getModificationDate() != null)
props.put(DCMetaData.DATE, docInfo.getModificationDate());
}
catch (Exception e)
{
log.warn("getModificationDate failed: " + e);
}
try
{
if (docInfo.getSubject() != null)
props.put(DCMetaData.DESCRIPTION, docInfo.getSubject());
}
catch (Exception e)
{
log.warn("getSubject failed: " + e);
}
try
{
if (docInfo.getTitle() != null)
props.put(DCMetaData.TITLE, docInfo.getTitle());
}
catch (Exception e)
{
log.warn("getTitle failed: " + e);
}