You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Amol Tiwari <Am...@oracle.com> on 2008/04/21 08:38:03 UTC

Regarding converting a PPT Slide to JPG/PNG

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.


Re: Regarding converting a PPT Slide to JPG/PNG

Posted by Yegor Kozlov <ye...@dinom.ru>.
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