doc.setDateOfCreation( docInfo.getCreationDate().getTime() ); doc.setDateOfLastModification( docInfo.getModificationDate().getTime() );
if( docInfo.getCreationDate() != null ) { doc.setDateOfCreation( docInfo.getCreationDate().getTime() ); } else { doc.setDateOfCreation( new GregorianCalendar().getTime() ); } if( docInfo.getModificationDate() != null ) { doc.setDateOfLastModification( docInfo.getModificationDate().getTime() ); } else { doc.setDateOfLastModification( new GregorianCalendar().getTime() ); }
    public Document parse( byte[] rawContent ) throws ParsingException    {        Document doc = null;        PDDocument pdfDoc = null;        org.pdfbox.pdfparser.PDFParser parser = null;        try        {            parser = new org.pdfbox.pdfparser.PDFParser( new ByteArrayInputStream( rawContent ) );            doc = MetaFormatFactory.createDocumentForContentType( ContentTypeFactory.CT_APPLICATION_PDF );            doc.setRawContent( rawContent );        }        catch ( Exception e )        {            logger.error( e );            throw new ParsingException( e.getMessage(), -1 );        }        try        {            parser.parse();            pdfDoc = parser.getPDDocument();            PDDocumentInformation docInfo = getDocumentInfo( pdfDoc );            doc.setAuthor( docInfo.getAuthor() );            doc.setDateOfCreation( docInfo.getCreationDate().getTime() );            doc.setDateOfLastModification( docInfo.getModificationDate().getTime() );            doc.setTitle( docInfo.getTitle() );            doc.setShortDescription( docInfo.getSubject() );            doc.setKeywords( docInfo.getKeywords() );        }        catch ( IOException e1 )        {            logger.error( e1 );            throw new ParsingException( e1.getMessage(), 0 );        }        finally        {            if (pdfDoc != null)            {                try                {                    pdfDoc.close();                }                catch ( IOException e2 )                {                    logger.error( e2 );                }            }        }        return doc;    }