Package org.odftoolkit.odfdom.incubator.doc.draw

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame.newDrawImageElement()


      } else if (this instanceof PresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom,
            XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
      }
      OdfDrawImage image = (OdfDrawImage) drawFrame.newDrawImageElement();
      String imagePath = image.newImage(imageUri);
      return imagePath;
    } catch (Exception ex) {
      Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex);
    }
View Full Code Here


        drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      } else if (this instanceof OdfPresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom, XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
      }
      OdfDrawImage image = (OdfDrawImage) drawFrame.newDrawImageElement();
      String imagePath = image.newImage(imageUri);
      return imagePath;
    } catch (Exception ex) {
      Logger.getLogger(OdfDocument.class.getName()).log(Level.SEVERE, null, ex);
    }
View Full Code Here

  public void testInsertImage_URI() throws Exception {
    LOG.info("insertImage from URI");
    OdfTextDocument odt = OdfTextDocument.newTextDocument();
    OdfTextParagraph para = (OdfTextParagraph) odt.getContentRoot().newTextPElement();
    OdfDrawFrame frame = (OdfDrawFrame) para.newDrawFrameElement();
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    String packagePath = image.newImage(ResourceUtilities.getURI("testA.jpg"));
    assertEquals(image.getXlinkTypeAttribute(), "simple");
    LOG.info(frame.getSvgWidthAttribute());
    LOG.info(frame.getSvgHeightAttribute());
    assert (frame.getSvgWidthAttribute().startsWith("19.") && frame.getSvgWidthAttribute().endsWith("cm"));
View Full Code Here

  public void testInsertImage_InputStream() throws Exception {
    LOG.info("insertImage from InputStream");
    OdfTextDocument odt = OdfTextDocument.newTextDocument();
    OdfTextParagraph para = (OdfTextParagraph) odt.getContentRoot().newTextPElement();
    OdfDrawFrame frame = (OdfDrawFrame) para.newDrawFrameElement();
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    String packagePath = "Pictures/myChosenImageName.jpg";
    String mediaType = "image/jpeg";
    image.newImage(new FileInputStream(ResourceUtilities.getAbsolutePath("testA.jpg")), packagePath, mediaType);
    assertEquals(image.getXlinkTypeAttribute(), "simple");
    assert (frame.getSvgWidthAttribute().startsWith("19.") && frame.getSvgWidthAttribute().endsWith("cm"));
View Full Code Here

        drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      } else if (this instanceof PresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom, XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
      }
      OdfDrawImage image = (OdfDrawImage) drawFrame.newDrawImageElement();
      String imagePath = image.newImage(imageUri);
      return imagePath;
    } catch (Exception ex) {
      Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex);
    }
View Full Code Here

        drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      } else if (this instanceof OdfPresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom, XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
      }
      OdfDrawImage image = (OdfDrawImage) drawFrame.newDrawImageElement();
      String imagePath = image.newImage(imageUri);
      return imagePath;
    } catch (Exception ex) {
      Logger.getLogger(OdfDocument.class.getName()).log(Level.SEVERE, null, ex);
    }
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.