@Test(expected = RuntimeException.class ) public void testLocalImageWeb(){ Image img = Image.from_WEB_URL(Utils.getAppRoot() + "/src/test/resources/dtpick.gif"); }
@Test(expected = RuntimeException.class ) public void testLocalImageClasspathFluent(){ Image img = Image.from_WEB_URL(Utils.getAppRoot() + "/src/test/resources/dtpick.gif").create(); }
/** * ignore because it could fail if you are under a proxy. So for a matter of demostration, uncomment and run it */ @Ignore @Test public void testWebImage(){ Image img = Image.from_WEB_URL("http://www.google.com.au/intl/en_com/images/srpr/logo1w.png"); assertEquals(2, TestUtils.regexCount(img.getContent(), "<*w:pict>")); assertEquals(2, TestUtils.regexCount(img.getContent(), "<*v:shapetype")); assertEquals(2, TestUtils.regexCount(img.getContent(), "<*v:shape[ >]")); //white space or > assertEquals(2, TestUtils.regexCount(img.getContent(), "wordml")); assertEquals(1, TestUtils.regexCount(img.getContent(), "width:275pt;height:95pt")); assertEquals(1, TestUtils.regexCount(img.getContent(), "BiGQFiipCSS8DCm1Cya1FiyNKzexKTjDDSrLDSvUDi3MEyzHFSvUFC3TGi7bGi/aEi7dGzLcFzPN")); }
tbl.addRow( TableRow.with( TableCell.with(Paragraph.withPieces( ParagraphPiece.with("Paragraph with Style inside TableCell").withStyle().bold().fontSize("20").create() ).create()).withStyle().bgColor("00FFFF").create(), "String" )); String img = Image.from_WEB_URL("http://www.google.com/images/logos/ps_logo2.png").setHeight("100").setWidth("300").create().getContent(); tbl.addRow( TableRow.with("this google logo: ", "Image here: "+ img + " == image before") );
"This one is coming from WEB, google web site: ").create()); myDoc.addEle(Image .from_WEB_URL("http://www.google.com/images/logos/ps_logo2.png")); .create()); myDoc.addEle(Image .from_WEB_URL("http://www.google.com/images/logos/ps_logo2.png") .setHeight("40").setWidth("80").create());