poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: Regarding converting a PPT Slide to JPG/PNG
Date Mon, 21 Apr 2008 08:54:01 GMT
This code was committed only a few days ago.  Wait, it will be
included in POI 3.0.3


Yegor

> Hi,

>  

> I have seen the earlier mailing list posts on how converting a PPT
> slide into JPG was not possible. ( I am referring to the list at:
> http://mail-archives.apache.org/mod_mbox/poi-user/200611.mbox/thread)

>  

> I have also read a code snippet which is trying to achieve this. (I
> am referring to http://poi.apache.org/hslf/how
> <http://poi.apache.org/hslf/how-to-shapes.html#Render> -to-shapes.html#Render)

>  

> FileInputStream is = new FileInputStream("slideshow.ppt");
>         SlideShow ppt = new SlideShow(is);
>         is.close();
>         
>         Dimension pgsize = ppt.getPageSize();
>  
>         Slide[] slide = ppt.getSlides();
>         for (int i = 0; i < slide.length; i++) {
>  
>             BufferedImage img = new BufferedImage(pgsize.width,
> pgsize.height, BufferedImage.TYPE_INT_RGB);
>             Graphics2D graphics = img.createGraphics();
>             //clear the drawing area
>             graphics.setPaint(Color.white);
>             graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
>  
>             //render
>             slide[i].draw(graphics); 
>  
>             //save the output
>             FileOutputStream out = new FileOutputStream("slide-"  + (i+1) + ".png");
>             javax.imageio.ImageIO.write(img, "png", out);
>             out.close();
>         }

>  

> The line marked Red (Slide[i].draw(graphics) ) is not correct. Does
> anyone have a working model for this code?

>  

>  

> Can anyone help me with this? Is it possible with the recent build?
> (I am using \poi-bin-3.0.2-FINAL-20080204\poi-3.0.2-FINAL)

>  

> Thanks and Regards!

>  

> Amol.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message