* @since 1.1.1
*/
public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel )
throws TransformerException
{
FOUserAgent foUserAgent = getDefaultUserAgent( fo, resourceDir );
if ( documentModel != null && documentModel.getMeta() != null )
{
// http://xmlgraphics.apache.org/fop/embedding.html#user-agent
String authors = documentModel.getMeta().getAllAuthorNames();
if ( StringUtils.isNotEmpty( authors ) )
{
foUserAgent.setAuthor( authors );
}
if ( StringUtils.isNotEmpty( documentModel.getMeta().getTitle() ) )
{
foUserAgent.setTitle( documentModel.getMeta().getTitle() );
}
String keywords = documentModel.getMeta().getAllKeyWords();
if ( StringUtils.isNotEmpty( keywords ) )
{
foUserAgent.setKeywords( keywords );
}
if ( StringUtils.isNotEmpty( documentModel.getMeta().getCreator() ) )
{
foUserAgent.setCreator( documentModel.getMeta().getCreator() );
}
if ( StringUtils.isNotEmpty( documentModel.getMeta().getGenerator() ) )
{
foUserAgent.setProducer( documentModel.getMeta().getGenerator() );
}
if ( documentModel.getMeta().getCreationDate() != null )
{
foUserAgent.setCreationDate( documentModel.getMeta().getCreationDate() );
}
}
if ( foUserAgent.getCreator() == null )
{
foUserAgent.setCreator( System.getProperty( "user.name" ) );
}
if ( foUserAgent.getCreationDate() == null )
{
foUserAgent.setCreationDate( new Date() );
}
convertFO2PDF( fo, pdf, resourceDir, foUserAgent );
}