Package org.apache.padaf.xmpbox.type

Examples of org.apache.padaf.xmpbox.type.ThumbnailType


    String img = "/9j/4AAQSkZJRgABAgEASABIAAD";
    setMethod.invoke(schema, height, width, format, img);
    List<ThumbnailType> found = ((List<ThumbnailType>) getMethod
        .invoke(schema));
    Assert.assertTrue(found.size() == 1);
    ThumbnailType t1 = found.get(0);
    Assert.assertEquals(height, t1.getHeight());
    Assert.assertEquals(width, t1.getWidth());
    Assert.assertEquals(format, t1.getFormat());
    Assert.assertEquals(img, t1.getImg());

  }
View Full Code Here


      ComplexPropertyContainer container)
          throws XmpUnexpectedTypeException, XmpParsingException,
          XMLStreamException, XmpUnknownPropertyTypeException,
          XmpPropertyFormatException {
    expectCurrentLocalName("li");
    ThumbnailType thumbnail = new ThumbnailType(metadata, altName
        .getPrefix(), altName.getLocalPart());
    int elmtType = reader.get().nextTag();
    QName eltName;
    String eltContent;
    while (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()
        .getName().getLocalPart().equals("li"))) {
      eltName = reader.get().getName();
      eltContent = reader.get().getElementText();
      if (eltName.getLocalPart().equals("height")) {
        thumbnail.setHeight(eltName.getPrefix(),
            eltName.getLocalPart(), Integer.valueOf(eltContent));
      } else if (eltName.getLocalPart().equals("width")) {
        thumbnail.setWidth(eltName.getPrefix(), eltName.getLocalPart(),
            Integer.valueOf(eltContent));
      } else if (eltName.getLocalPart().equals("image")) {
        thumbnail.setImg(eltName.getPrefix(), eltName.getLocalPart(),
            eltContent);
      } else if (eltName.getLocalPart().equals("format")) {
        thumbnail.setFormat(eltName.getPrefix(),
            eltName.getLocalPart(), eltContent);
      } else {
        throw new XmpParsingException(
            "Unknown property name for a thumbnail element : "
                + eltName.getLocalPart());
View Full Code Here

    if (altThumbs == null) {
      altThumbs = new ComplexProperty(metadata, localPrefix, THUMBNAILS,
          ComplexProperty.ALTERNATIVE_ARRAY);
      addProperty(altThumbs);
    }
    ThumbnailType thumb = new ThumbnailType(metadata, "rdf", "li");
    /*
     * <xapGImg:height>162</xapGImg:height>
     * <xapGImg:width>216</xapGImg:width>
     * <xapGImg:format>JPEG</xapGImg:format>
     * <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD</xapGImg:image>
     */
    thumb.setHeight("xapGImg", "height", height);
    thumb.setWidth("xapGImg", "width", width);
    thumb.setFormat("xapGImg", "format", format);
    thumb.setImg("xapGImg", "image", img);
    altThumbs.getContainer().addProperty(thumb);
    // SaveMetadataHelper.serialize(metadata, System.out);
  }
View Full Code Here

    // THUMBNAILS TEST
    List<ThumbnailType> thumbs = metadata.getXMPBasicSchema()
        .getThumbnails();
    Assert.assertNotNull(thumbs);
    Assert.assertEquals(1, thumbs.size());
    ThumbnailType thumb = thumbs.get(0);
    /*
     * <xapGImg:height>162</xapGImg:height>
     * <xapGImg:width>216</xapGImg:width>
     * <xapGImg:format>JPEG</xapGImg:format>
     * <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD</xapGImg:image>
     */
    Assert.assertEquals(new Integer(162), thumb.getHeight());
    Assert.assertEquals(new Integer(216), thumb.getWidth());
    Assert.assertEquals("JPEG", thumb.getFormat());
    Assert.assertEquals("/9j/4AAQSkZJRgABAgEASABIAAD", thumb.getImg());

    // PDFA Extension
    // Check numbers of schema descriptions
    Assert.assertTrue(metadata.getPDFExtensionSchema()
        .getDescriptionSchema().size() == 1);
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.type.ThumbnailType

Copyright © 2018 www.massapicom. 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.