Home Java Poi Retrieve The Size of Slide Using Java



Retrieve The Size of Slide Using Java
Posted on: March 14, 2008 at 12:00 AM
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.

Related Tags for Retrieve The Size of Slide Using Java:
cideobjectiopropertysizemethodfindgetpageheightwidthusingthisidcreatesigningexampletopagesexamssieslidesignlipeimfrominasmjesspecagemeobjproxawhichxampssigninrespectspespatisimeivmplpropergodimensioneaandarrtropesliwidzssthesifinesijepleplpropprndonomo


More Tutorials from this section

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

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.