Home Java Poi Retrieve The Size of Slide Using Java
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Retrieve The Size of Slide Using Java

Advertisement
In this example we are going to find height and width of the slide.

Retrieve The Size of Slide Using Java

     


In this example we are going to find height and width of the slide.

In this example we create an object of dimension in which we are assigning the size of page. From this object we get the width and height We are using getPageSize() method to get the dimension of page , height and width  property to get the height and width of the page respectively. 

 

  
  
 The code of the program is given below:

import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.SlideShow;
import java.io.*;
class retrieveSlideSize{
  public static void main(String a[])
  {
  try
  {  SlideShow slideShow = new SlideShow(new 
HSLFSlideShow
("slideshow.ppt"));
 java.awt.Dimension pgsize = slideShow.getPageSize();
  int pgx = pgsize.width; 
  int pgy = pgsize.height; 
  System.out.println("Width:"+pgx);
  System.out.println("Height:"+pgy);  
  FileOutputStream out = new FileOutputStream
(
"retrieveSlideSize.ppt");
  slideShow.write(out);
  out.close();
  }catch(Exception e){}
  }}

The output of the program is given below:

C:\POI3.0\exmples\PowerPoint>javac retrieveSlideSize.jav
C:\POI3.0\exmples\PowerPoint>java retrieveSlideSize
Width:792
Height:612

Download this example.

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 14, 2008

Ask Questions?    Discuss: Retrieve The Size of Slide Using Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com