Examples of PDDocument


Examples of com.dotcms.repackage.org.apache.pdfbox.pdmodel.PDDocument

    else if (fileExt.equals(".pdf")) {
      try {
        PDFParser parser = new PDFParser(fis);
        parser.parse();

            PDDocument pdDoc= parser.getPDDocument();

        StringWriter stringWriter = new StringWriter();

        PDFTextStripper stripper = new PDFTextStripper();
        stripper.setLineSeparator("\n");
        stripper.writeText(pdDoc, stringWriter);

        text = stringWriter.toString();

        stringWriter.close();
        pdDoc.close();
      }
      catch (Exception e) {
        _log.error(e.getMessage());
      }
    }
View Full Code Here

Examples of de.intarsys.pdf.pd.PDDocument

  public BufferedImage getPageImage(File inputFile, String password, int page, int rotation)
      throws ThumbnailCreationException {
    BufferedImage retVal = null;
    IGraphicsContext graphics = null;
    PDDocument pdfDoc = null;
    if (inputFile != null && inputFile.exists() && inputFile.isFile()) {
      try {
        pdfDoc = openDoc(inputFile, password);
        PDPage pdPage = pdfDoc.getPageTree().getPageAt(page - 1);
        Rectangle2D rect = pdPage.getCropBox().toNormalizedRectangle();

        retVal = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) retVal.getGraphics();
        graphics = new CwtAwtGraphicsContext(g2);
        // setup user space
        AffineTransform imgTransform = graphics.getTransform();
        imgTransform.scale(1, -1);
        imgTransform.translate(-rect.getMinX(), -rect.getMaxY());
        graphics.setTransform(imgTransform);
        graphics.setBackgroundColor(Color.WHITE);
        graphics.fill(rect);
        CSContent content = pdPage.getContentStream();
        if (content != null) {
          JPodRenderer renderer = new JPodRenderer(null, graphics);
          renderer.process(content, pdPage.getResources());
        }
        if (pdfDoc != null) {
          pdfDoc.close();
        }
        int totalRotation = (rotation + pdPage.getRotate()) % 360;
        if (totalRotation != 0) {
          Image rotated = ImageUtility.rotateImage(retVal, totalRotation);
          retVal = new BufferedImage(rotated.getWidth(null), rotated.getHeight(null),
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument

  @SuppressWarnings("unchecked")
  public void prepare(RawDocument rawDocument) throws RegainException {
    String url = rawDocument.getUrl();

    InputStream stream = null;
    PDDocument pdfDocument = null;

    try {
      // Create a InputStream that reads the content.
      stream = rawDocument.getContentAsStream();

      // Parse the content
      PDFParser parser = new PDFParser(stream);
      parser.parse();
      pdfDocument = parser.getPDDocument();

      // Decrypt the PDF-Dokument
      if (pdfDocument.isEncrypted()) {
        mLog.debug("Document is encrypted: " + url);
        StandardDecryptionMaterial sdm = new StandardDecryptionMaterial("");
        pdfDocument.openProtection(sdm);
        AccessPermission ap = pdfDocument.getCurrentAccessPermission();

        if (!ap.canExtractContent()) {
          throw new RegainException("Document is encrypted and can't be opened: " + url);
        }
      }

      // Extract the text with a utility class
      PDFTextStripper stripper = new PDFTextStripper();
      stripper.setSuppressDuplicateOverlappingText(false);
      stripper.setSortByPosition(true);
      stripper.setStartPage(1);
      stripper.setEndPage(Integer.MAX_VALUE);

      setCleanedContent(stripper.getText(pdfDocument).replaceAll("visiblespace", " "));

      // extract annotations
      StringBuilder annotsResult = new StringBuilder();
      List allPages = pdfDocument.getDocumentCatalog().getAllPages();
      for (int i = 0; i < allPages.size(); i++) {
        int pageNum = i + 1;
        PDPage page = (PDPage) allPages.get(i);
        List<PDAnnotation> annotations = page.getAnnotations();
        if (annotations.size() < 1) {
          continue;
        }
        mLog.debug("Total annotations = " + annotations.size());
        mLog.debug("\nProcess Page " + pageNum + "...");
        for (PDAnnotation annotation : annotations) {
          if (annotation.getContents() != null && annotation.getContents().length() > 0) {
            annotsResult.append(annotation.getContents());
            annotsResult.append(" ");
            mLog.debug("Text from annotation: " + annotation.getContents());
          }
        }
      }
      if (annotsResult.length() > 0) {
        setCleanedContent(getCleanedContent() + " Annotations " + annotsResult.toString());
      }

      // Get the meta data
      PDDocumentInformation info = pdfDocument.getDocumentInformation();
      StringBuilder metaData = new StringBuilder();
      metaData.append("p.");
      metaData.append(Integer.toString(pdfDocument.getNumberOfPages()));
      metaData.append(" ");

      // Check if fields are null
      if (info.getAuthor() != null) {
        metaData.append(info.getAuthor());
        metaData.append(" ");
      }
      if (info.getSubject() != null) {
        metaData.append(info.getSubject());
        metaData.append(" ");
      }
      if (info.getKeywords() != null) {
        metaData.append(info.getKeywords());
        metaData.append(" ");
      }

      if (info.getTitle() != null) {
        setTitle(info.getTitle());
      }

      setCleanedMetaData(metaData.toString());
      if (mLog.isDebugEnabled()) {
        mLog.debug("Extracted meta data ::" + getCleanedMetaData()
                + ":: from " + rawDocument.getUrl());
      }

    } catch (CryptographyException exc) {
      throw new RegainException("Error decrypting document: " + url, exc);

    } catch (BadSecurityHandlerException exc) {
      // They didn't supply a password and the default of "" was wrong.
      throw new RegainException("Document is encrypted: " + url, exc);

    } catch (IOException exc) {
      throw new RegainException("Error reading document: " + url, exc);

    } finally {
      if (stream != null) {
        try {
          stream.close();
        } catch (Exception exc) {
        }
      }
      if (pdfDocument != null) {
        try {
          pdfDocument.close();
        } catch (Exception exc) {
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument

        // check memory for parser
        if (!MemoryControl.request(200 * 1024 * 1024, true))
            throw new Parser.Failure("Not enough Memory available for pdf parser: " + MemoryControl.available(), location);

        // create a pdf parser
        PDDocument pdfDoc = null;
        //final PDFParser pdfParser;
        try {
            Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
            pdfDoc = PDDocument.load(source);
            //pdfParser = new PDFParser(source);
            //pdfParser.parse();
            //pdfDoc = pdfParser.getPDDocument();
        } catch (final IOException e) {
            throw new Parser.Failure(e.getMessage(), location);
        } finally {
            Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
        }

        if (pdfDoc.isEncrypted()) {
            try {
                pdfDoc.openProtection(new StandardDecryptionMaterial(""));
            } catch (final BadSecurityHandlerException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
                throw new Parser.Failure("Document is encrypted (1): " + e.getMessage(), location);
            } catch (final IOException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
                throw new Parser.Failure("Document is encrypted (2): " + e.getMessage(), location);
            } catch (final CryptographyException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
                throw new Parser.Failure("Document is encrypted (3): " + e.getMessage(), location);
            }
            final AccessPermission perm = pdfDoc.getCurrentAccessPermission();
            if (perm == null || !perm.canExtractContent())
                throw new Parser.Failure("Document is encrypted and cannot be decrypted", location);
        }

        // extracting some metadata
        final PDDocumentInformation info = pdfDoc.getDocumentInformation();
        String docTitle = null, docSubject = null, docAuthor = null, docPublisher = null, docKeywordStr = null;
        if (info != null) {
            docTitle = info.getTitle();
            docSubject = info.getSubject();
            docAuthor = info.getAuthor();
            docPublisher = info.getProducer();
            if (docPublisher == null || docPublisher.length() == 0) docPublisher = info.getCreator();
            docKeywordStr = info.getKeywords();
            // unused:
            // info.getTrapped());
            // info.getCreationDate());
            // info.getModificationDate();
        }

        if (docTitle == null || docTitle.length() == 0) {
            docTitle = MultiProtocolURI.unescape(location.getFileName());
        }
        CharBuffer writer = null;
        try {
            // create a writer for output
            PDFTextStripper stripper = null;
            writer = new CharBuffer();
            stripper = new PDFTextStripper();
            stripper.writeText(pdfDoc, writer); // may throw a NPE
            pdfDoc.close();
            writer.close();
        } catch (final IOException e) {
            // close the writer
            if (writer != null) try { writer.close(); } catch (final Exception ex) {}
            try {pdfDoc.close();} catch (final IOException ee) {}
            //throw new Parser.Failure(e.getMessage(), location);
        } catch (final NullPointerException e) {
            // this exception appeared after the insertion of the jempbox-1.5.0.jar library
            Log.logException(e);
            // close the writer
            if (writer != null) try { writer.close(); } catch (final Exception ex) {}
            try {pdfDoc.close();} catch (final IOException ee) {}
            //throw new Parser.Failure(e.getMessage(), location);
        } finally {
            try {pdfDoc.close();} catch (final IOException e) {}
        }
        pdfDoc = null;

        String[] docKeywords = null;
        if (docKeywordStr != null) {
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

   * @param xmpString
   * @throws Exception
   */
  public void writeManually(File tempFile, String xmpString) throws Exception {

    PDDocument document = null;

    try {
      document = PDDocument.load(tempFile.getAbsoluteFile());
      if (document.isEncrypted()) {
        System.err
            .println("Error: Cannot add metadata to encrypted document.");
        System.exit(1);
      }
      PDDocumentCatalog catalog = document.getDocumentCatalog();

      // Convert to UTF8 and make available for metadata.
      ByteArrayOutputStream bs = new ByteArrayOutputStream();
      OutputStreamWriter os = new OutputStreamWriter(bs, "UTF8");
      os.write(xmpString);
      os.close();
      ByteArrayInputStream in = new ByteArrayInputStream(bs.toByteArray());

      PDMetadata metadataStream = new PDMetadata(document, in, false);
      catalog.setMetadata(metadataStream);

      document.save(tempFile.getAbsolutePath());

    } finally {
      if (document != null)
        document.close();
    }
  }
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

   */
  public void setUp() throws IOException, COSVisitorException {

    pdfFile = File.createTempFile("JabRef", ".pdf");

    PDDocument pdf = null;
    try {
      pdf = new PDDocument();
      pdf.addPage(new PDPage()); // Need page to open in Acrobat
      pdf.save(pdfFile.getAbsolutePath());
    } finally {
      if (pdf != null)
        pdf.close();
    }

    // Don't forget to initialize the preferences
    if (Globals.prefs == null) {
      Globals.prefs = JabRefPreferences.getInstance();
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

    assertEquals(BibtexEntryType.ARTICLE, e.getType());
  }

  public static String readManually(File tempFile) throws IOException {

    PDDocument document = null;

    try {
      document = PDDocument.load(tempFile.getAbsoluteFile());
      if (document.isEncrypted()) {
        System.err
            .println("Error: Cannot add metadata to encrypted document.");
        System.exit(1);
      }
      PDDocumentCatalog catalog = document.getDocumentCatalog();
      PDMetadata meta = catalog.getMetadata();

      if (meta == null) {
        return null;
      } else {
        // PDMetadata.getInputStreamAsString() does not work

        // Convert to UTF8 and make available for metadata.
        InputStreamReader is = new InputStreamReader(meta
            .createInputStream(), "UTF8");
        return slurp(is).trim(); // Trim to kill padding end-newline.
      }
    } finally {
      if (document != null)
        document.close();
    }
  }
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

      assertEquals(t1BibtexEntry(), 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<XMPSchema> 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, 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));
        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();
        }
      }
    }
  }
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

    List<BibtexEntry> l = new LinkedList<BibtexEntry>();
    l.add(t3BibtexEntry());

    XMPUtil.writeXMP(pdfFile, l, null, true);

    PDDocument document = PDDocument.load(pdfFile.getAbsoluteFile());
    try {
      if (document.isEncrypted()) {
        System.err
            .println("Error: Cannot add metadata to encrypted document.");
        System.exit(1);
      }

      assertEquals("Kelly Clarkson and Ozzy Osbourne", document
          .getDocumentInformation().getAuthor());
      assertEquals("Hypersonic ultra-sound", document
          .getDocumentInformation().getTitle());
      assertEquals("Huey Duck and Dewey Duck and Louie Duck", document
          .getDocumentInformation().getCustomMetadataValue(
              "bibtex/editor"));
      assertEquals("Clarkson06", document.getDocumentInformation()
          .getCustomMetadataValue("bibtex/bibtexkey"));
      assertEquals("peanut,butter,jelly", document
          .getDocumentInformation().getKeywords());

      assertEquals(t3BibtexEntry(), XMPUtil
          .getBibtexEntryFromDocumentInformation(document
              .getDocumentInformation()));

      PDDocumentCatalog catalog = document.getDocumentCatalog();
      PDMetadata metaRaw = catalog.getMetadata();

      if (metaRaw == null) {
        fail();
        return;
      }

      XMPMetadata meta = new XMPMetadata(XMLUtil.parse(metaRaw
          .createInputStream()));
      meta.addXMLNSMapping(XMPSchemaBibtex.NAMESPACE,
          XMPSchemaBibtex.class);

      // Check Dublin Core
      List<XMPSchema> schemas = meta
          .getSchemasByNamespaceURI("http://purl.org/dc/elements/1.1/");
      assertEquals(1, schemas.size());

      XMPSchemaDublinCore dcSchema = (XMPSchemaDublinCore) schemas
          .iterator().next();
      assertNotNull(dcSchema);

      assertEquals("Hypersonic ultra-sound", dcSchema.getTitle());
      assertEquals("1982-07", dcSchema.getSequenceList("dc:date").get(0));
      assertEquals("Kelly Clarkson", dcSchema.getCreators().get(0));
      assertEquals("Ozzy Osbourne", dcSchema.getCreators().get(1));
      assertEquals("Huey Duck", dcSchema.getContributors().get(0));
      assertEquals("Dewey Duck", dcSchema.getContributors().get(1));
      assertEquals("Louie Duck", dcSchema.getContributors().get(2));
      assertEquals("Inproceedings", dcSchema.getTypes().get(0));
      assertEquals("bibtex/bibtexkey/Clarkson06", dcSchema
          .getRelationships().get(0));
      assertEquals("peanut", dcSchema.getSubjects().get(0));
      assertEquals("butter", dcSchema.getSubjects().get(1));
      assertEquals("jelly", dcSchema.getSubjects().get(2));

      /**
       * Bibtexkey, Journal, pdf, booktitle
       */
      assertEquals(4, dcSchema.getRelationships().size());

      assertEquals(t3BibtexEntry(), XMPUtil
          .getBibtexEntryFromDublinCore(dcSchema));

    } finally {
      document.close();
    }

  }
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument

    List<BibtexEntry> l = new LinkedList<BibtexEntry>();
    l.add(t3BibtexEntry());

    XMPUtil.writeXMP(pdfFile, l, null, true);

    PDDocument document = PDDocument.load(pdfFile.getAbsoluteFile());
    try {
      if (document.isEncrypted()) {
        System.err
            .println("Error: Cannot add metadata to encrypted document.");
        System.exit(1);
      }

      assertEquals("Kelly Clarkson and Ozzy Osbourne", document
          .getDocumentInformation().getAuthor());
      assertEquals("Hypersonic ultra-sound", document
          .getDocumentInformation().getTitle());
      assertEquals("Huey Duck and Dewey Duck and Louie Duck", document
          .getDocumentInformation().getCustomMetadataValue(
              "bibtex/editor"));
      assertEquals("Clarkson06", document.getDocumentInformation()
          .getCustomMetadataValue("bibtex/bibtexkey"));
      assertEquals("peanut,butter,jelly", document
          .getDocumentInformation().getKeywords());

      assertEquals(t3BibtexEntry(), XMPUtil
          .getBibtexEntryFromDocumentInformation(document
              .getDocumentInformation()));

      PDDocumentCatalog catalog = document.getDocumentCatalog();
      PDMetadata metaRaw = catalog.getMetadata();

      if (metaRaw == null) {
        fail();
      }

      XMPMetadata meta = new XMPMetadata(XMLUtil.parse(metaRaw
          .createInputStream()));
      meta.addXMLNSMapping(XMPSchemaBibtex.NAMESPACE,
          XMPSchemaBibtex.class);

      // Check Dublin Core
      List<XMPSchema> schemas = meta
          .getSchemasByNamespaceURI("http://purl.org/dc/elements/1.1/");

      assertEquals(1, schemas.size());

      XMPSchemaDublinCore dcSchema = (XMPSchemaDublinCore) schemas
          .iterator().next();
      assertNotNull(dcSchema);

      assertEquals("Hypersonic ultra-sound", dcSchema.getTitle());
      assertEquals("1982-07", dcSchema.getSequenceList("dc:date").get(0));
      assertEquals("Kelly Clarkson", dcSchema.getCreators().get(0));
      assertEquals("Ozzy Osbourne", dcSchema.getCreators().get(1));
      assertEquals("Huey Duck", dcSchema.getContributors().get(0));
      assertEquals("Dewey Duck", dcSchema.getContributors().get(1));
      assertEquals("Louie Duck", dcSchema.getContributors().get(2));
      assertEquals("Inproceedings", dcSchema.getTypes().get(0));
      assertEquals("bibtex/bibtexkey/Clarkson06", dcSchema
          .getRelationships().get(0));
      assertEquals("peanut", dcSchema.getSubjects().get(0));
      assertEquals("butter", dcSchema.getSubjects().get(1));
      assertEquals("jelly", dcSchema.getSubjects().get(2));

      /**
       * Bibtexkey, Journal, pdf, booktitle
       */
      assertEquals(4, dcSchema.getRelationships().size());

      assertEquals(t3BibtexEntry(), XMPUtil
          .getBibtexEntryFromDublinCore(dcSchema));

    } finally {
      document.close();
    }

  }
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.