Examples of XMPSchemaBasic


Examples of org.apache.jempbox.xmp.XMPSchemaBasic

               {
                  log.warn("getDate failed: " + e);
               }
            }

            XMPSchemaBasic basic = metadata.getBasicSchema();
            if (basic != null)
            {
               try
               {
                  if (basic.getCreateDate() != null)
                     props.put(DCMetaData.DATE, basic.getCreateDate());
               }
               catch (Exception e)
               {
                  log.warn("getCreationDate failed: " + e);
               }
               try
               {
                  if (basic.getModifyDate() != null)
                     props.put(DCMetaData.DATE, basic.getModifyDate());
               }
               catch (Exception e)
               {
                  log.warn("getModificationDate failed: " + e);
               }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                        display("Keywords:", pdf.getKeywords());
                        display("PDF Version:", pdf.getPDFVersion());
                        display("PDF Producer:", pdf.getProducer());
                    }
   
                    XMPSchemaBasic basic = metadata.getBasicSchema();
                    if (basic != null)
                    {
                        display("Create Date:", basic.getCreateDate());
                        display("Modify Date:", basic.getModifyDate());
                        display("Creator Tool:", basic.getCreatorTool());
                    }
                }
                else
                {
                    // The pdf doesn't contain any metadata, try to use the document information instead
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                        display("Keywords:", pdf.getKeywords());
                        display("PDF Version:", pdf.getPDFVersion());
                        display("PDF Producer:", pdf.getProducer());
                    }
   
                    XMPSchemaBasic basic = metadata.getBasicSchema();
                    if (basic != null)
                    {
                        display("Create Date:", basic.getCreateDate());
                        display("Modify Date:", basic.getModifyDate());
                        display("Creator Tool:", basic.getCreatorTool());
                    }
                }
                else
                {
                    // The pdf doesn't contain any metadata, try to use the document information instead
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                XMPSchemaPDF pdfSchema = metadata.addPDFSchema();
                pdfSchema.setKeywords( info.getKeywords() );
                pdfSchema.setProducer( info.getProducer() );

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

                XMPSchemaDublinCore dcSchema = metadata.addDublinCoreSchema();
                dcSchema.setTitle( info.getTitle() );
                dcSchema.addCreator( "PDFBox" );
                dcSchema.setDescription( info.getSubject() );
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                        {
                           log.warn("getProducer failed: " + e);
                        }
                     }

                     XMPSchemaBasic basic = metadata.getBasicSchema();
                     if (basic != null)
                     {
                        try
                        {
                           if (basic.getCreateDate() != null)
                              props.put(DCMetaData.DATE, basic.getCreateDate());
                        }
                        catch (Exception e)
                        {
                           log.warn("getCreationDate failed: " + e);
                        }
                        try
                        {
                           if (basic.getModifyDate() != null)
                              props.put(DCMetaData.DATE, basic.getModifyDate());
                        }
                        catch (Exception e)
                        {
                           log.warn("getModificationDate failed: " + e);
                        }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                        {
                           log.warn("getProducer failed: " + e);
                        }
                     }

                     XMPSchemaBasic basic = metadata.getBasicSchema();
                     if (basic != null)
                     {
                        try
                        {
                           if (basic.getCreateDate() != null)
                              props.put(DCMetaData.DATE, basic.getCreateDate());
                        }
                        catch (Exception e)
                        {
                           log.warn("getCreationDate failed: " + e);
                        }
                        try
                        {
                           if (basic.getModifyDate() != null)
                              props.put(DCMetaData.DATE, basic.getModifyDate());
                        }
                        catch (Exception e)
                        {
                           log.warn("getModificationDate failed: " + e);
                        }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                    display("Keywords:", pdf.getKeywords());
                    display("PDF Version:", pdf.getPDFVersion());
                    display("PDF Producer:", pdf.getProducer());
                }

                XMPSchemaBasic basic = metadata.getBasicSchema();
                if (basic != null)
                {
                    display("Create Date:", basic.getCreateDate());
                    display("Modify Date:", basic.getModifyDate());
                    display("Creator Tool:", basic.getCreatorTool());
                }
            }
            finally
            {
                if( document != null )
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchemaBasic

                        {
                           LOG.warn("getProducer failed: " + e.getMessage());
                        }
                     }

                     XMPSchemaBasic basic = metadata.getBasicSchema();
                     if (basic != null)
                     {
                        try
                        {
                           if (basic.getCreateDate() != null)
                              props.put(DCMetaData.DATE, basic.getCreateDate());
                        }
                        catch (Exception e)
                        {
                           LOG.warn("getCreationDate failed: " + e.getMessage());
                        }
                        try
                        {
                           if (basic.getModifyDate() != null)
                              props.put(DCMetaData.DATE, basic.getModifyDate());
                        }
                        catch (Exception e)
                        {
                           LOG.warn("getModificationDate failed: " + e.getMessage());
                        }
View Full Code Here

Examples of org.jempbox.xmp.XMPSchemaBasic

        assertEquals("application/pdf", dc.getFormat());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaBasic.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaBasic bs = (XMPSchemaBasic) schemas.get(0);
        assertEquals("Acrobat PDFMaker 7.0.7", bs.getCreatorTool());

        Calendar c = Calendar.getInstance();
        c.clear();
        c.set(Calendar.YEAR, 2006);
        c.set(Calendar.MONTH, Calendar.AUGUST);
        c.set(Calendar.DATE, 7);
        c.set(Calendar.HOUR, 14);
        c.set(Calendar.MINUTE, 44);
        c.set(Calendar.SECOND, 24);
        c.setTimeZone(TimeZone.getTimeZone("GMT+2"));

        Calendar other = bs.getCreateDate();

        assertEquals(c.get(Calendar.YEAR), other.get(Calendar.YEAR));
        assertEquals(c.get(Calendar.MONTH), other.get(Calendar.MONTH));
        assertEquals(c.get(Calendar.DATE), other.get(Calendar.DATE));
        assertEquals(c.get(Calendar.HOUR), other.get(Calendar.HOUR));
        assertEquals(c.get(Calendar.MINUTE), other.get(Calendar.MINUTE));
        assertEquals(c.get(Calendar.SECOND), other.get(Calendar.SECOND));
        assertTrue(c.getTimeZone().hasSameRules(other.getTimeZone()));

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaMediaManagement.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaMediaManagement mm = (XMPSchemaMediaManagement) schemas
            .get(0);
        assertEquals("17", mm.getSequenceList("xapMM:VersionID").get(0));

      } finally {
        if (document != null) {
          document.close();
        }
      }
    }

    { // Now alter the Bibtex entry, write it and do all the checks again
      BibtexEntry toSet = t1BibtexEntry();
      toSet.setField("author", "Pokemon!");

      XMPUtil.writeXMP(pdfFile, toSet, null);

      List l = XMPUtil.readXMP(pdfFile.getAbsoluteFile());
      assertEquals(1, l.size());
      BibtexEntry e = (BibtexEntry) l.get(0);

      assertEquals(toSet, e);

      // This is what we really want to test: Is the rest of the
      // descriptions still there?

      PDDocument document = null;
      try {
        document = PDDocument.load(pdfFile.getAbsoluteFile());
        if (document.isEncrypted()) {
          throw new IOException(
              "Error: Cannot read metadata from encrypted document.");
        }
        PDDocumentCatalog catalog = document.getDocumentCatalog();
        PDMetadata metaRaw = catalog.getMetadata();

        XMPMetadata meta;
        if (metaRaw != null) {
          meta = new XMPMetadata(XMLUtil.parse(metaRaw
              .createInputStream()));
        } else {
          meta = new XMPMetadata();
        }
        meta.addXMLNSMapping(XMPSchemaBibtex.NAMESPACE,
            XMPSchemaBibtex.class);

        List schemas = meta.getSchemas();

        assertEquals(4, schemas.size());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaBibtex.NAMESPACE);
        assertEquals(1, schemas.size());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaDublinCore.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaDublinCore dc = (XMPSchemaDublinCore) schemas.get(0);
        assertEquals("application/pdf", dc.getFormat());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaBasic.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaBasic bs = (XMPSchemaBasic) schemas.get(0);
        assertEquals("Acrobat PDFMaker 7.0.7", bs.getCreatorTool());

        Calendar c = Calendar.getInstance();
        c.clear();
        c.set(Calendar.YEAR, 2006);
        c.set(Calendar.MONTH, 7);
        c.set(Calendar.DATE, 7);
        c.set(Calendar.HOUR, 14);
        c.set(Calendar.MINUTE, 44);
        c.set(Calendar.SECOND, 24);
        c.setTimeZone(TimeZone.getTimeZone("GMT+2"));

        Calendar other = bs.getCreateDate();

        assertEquals(c.get(Calendar.YEAR), other.get(Calendar.YEAR));
        assertEquals(c.get(Calendar.MONTH), other.get(Calendar.MONTH));
        assertEquals(c.get(Calendar.DATE), other.get(Calendar.DATE));
        assertEquals(c.get(Calendar.HOUR), other.get(Calendar.HOUR));
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.