Examples of PDDocumentInformation


Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

        }
        if( source.isEncrypted() )
        {
            throw new IOException( "Error: source PDF is encrypted, can't append encrypted PDF documents." );
        }
        PDDocumentInformation destInfo = destination.getDocumentInformation();
        PDDocumentInformation srcInfo = source.getDocumentInformation();
        destInfo.getDictionary().mergeInto( srcInfo.getDictionary() );

        PDDocumentCatalog destCatalog = destination.getDocumentCatalog();
        PDDocumentCatalog srcCatalog = source.getDocumentCatalog();

        // use the highest version number for the resulting pdf
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

    List<ValidationError> ve = new ArrayList<ValidationError>();

    if (document == null) {
      throw new ValidationException("Document provided is null");
    } else {
      PDDocumentInformation dico = document.getDocumentInformation();
      if (metadata == null) {
        throw new ValidationException("Metadata provided are null");
      } else {
        DublinCoreSchema dc = metadata.getDublinCoreSchema();
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

        }
        if( source.isEncrypted() )
        {
            throw new IOException( "Error: source PDF is encrypted, can't append encrypted PDF documents." );
        }
        PDDocumentInformation destInfo = destination.getDocumentInformation();
        PDDocumentInformation srcInfo = source.getDocumentInformation();
        destInfo.getDictionary().mergeInto( srcInfo.getDictionary() );

        PDDocumentCatalog destCatalog = destination.getDocumentCatalog();
        PDDocumentCatalog srcCatalog = source.getDocumentCatalog();

        if( destCatalog.getOpenAction() == null )
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

        stripper.writeText(document, output);
        return output.toString().trim();
    }

    public static String getDocumentMetadataValue(PDDocument document, COSName name) {
        PDDocumentInformation info = document.getDocumentInformation();
        return info.getDictionary().getString(name);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

                    }
                }
                else
                {
                    // The pdf doesn't contain any metadata, try to use the document information instead
                    PDDocumentInformation information = document.getDocumentInformation();
                    if ( information != null)
                    {
                        showDocumentInformation(information);
                    }
                }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

                {
                    System.err.println( "Error: Cannot add metadata to encrypted document." );
                    System.exit( 1 );
                }
                PDDocumentCatalog catalog = document.getDocumentCatalog();
                PDDocumentInformation info = document.getDocumentInformation();

                XMPMetadata metadata = XMPMetadata.createXMPMetadata();

                AdobePDFSchema pdfSchema = metadata.createAndAddAdobePDFSchema();
                pdfSchema.setKeywords( info.getKeywords() );
                pdfSchema.setProducer( info.getProducer() );

                XMPBasicSchema basicSchema = metadata.createAndAddXMPBasicSchema();
                basicSchema.setModifyDate( info.getModificationDate() );
                basicSchema.setCreateDate( info.getCreationDate() );
                basicSchema.setCreatorTool( info.getCreator() );
                basicSchema.setMetadataDate( new GregorianCalendar() );

                DublinCoreSchema dcSchema = metadata.createAndAddDublinCoreSchema();
                dcSchema.setTitle( info.getTitle() );
                dcSchema.addCreator( "PDFBox" );
                dcSchema.setDescription( info.getSubject() );

                PDMetadata metadataStream = new PDMetadata(document);
                catalog.setMetadata( metadataStream );
               
                XmpSerializer serializer = new XmpSerializer();
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

     *
     * @throws IOException If there is an error getting the page count.
     */
    public void printMetadata( PDDocument document ) throws IOException
    {
        PDDocumentInformation info = document.getDocumentInformation();
        PDDocumentCatalog cat = document.getDocumentCatalog();
        PDMetadata metadata = cat.getMetadata();
        System.out.println( "Page Count=" + document.getNumberOfPages() );
        System.out.println( "Title=" + info.getTitle() );
        System.out.println( "Author=" + info.getAuthor() );
        System.out.println( "Subject=" + info.getSubject() );
        System.out.println( "Keywords=" + info.getKeywords() );
        System.out.println( "Creator=" + info.getCreator() );
        System.out.println( "Producer=" + info.getProducer() );
        System.out.println( "Creation Date=" + formatDate( info.getCreationDate() ) );
        System.out.println( "Modification Date=" + formatDate( info.getModificationDate() ) );
        System.out.println( "Trapped=" + info.getTrapped() );
        if( metadata != null )
        {
            System.out.println( "Metadata=" + metadata.getInputStreamAsString() );
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

         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);
               }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

        }
        if( source.isEncrypted() )
        {
            throw new IOException( "Error: source PDF is encrypted, can't append encrypted PDF documents." );
        }
        PDDocumentInformation destInfo = destination.getDocumentInformation();
        PDDocumentInformation srcInfo = source.getDocumentInformation();
        destInfo.getDictionary().mergeInto( srcInfo.getDictionary() );

        PDDocumentCatalog destCatalog = destination.getDocumentCatalog();
        PDDocumentCatalog srcCatalog = source.getDocumentCatalog();

        // use the highest version number for the resulting pdf
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocumentInformation

                    }
                }
                else
                {
                    // The pdf doesn't contain any metadata, try to use the document information instead
                    PDDocumentInformation information = document.getDocumentInformation();
                    if ( information != null)
                    {
                        showDocumentInformation(information);
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.