You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/11/12 15:49:58 UTC
DO NOT REPLY [Bug 46196] New: Performance problem while converting
the ppt slide to png/jpg
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
Summary: Performance problem while converting the ppt slide to
png/jpg
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: HSLF
AssignedTo: dev@poi.apache.org
ReportedBy: ch_raghu_nath@yahoo.com
I am using the below code to convert the single ppt to png slide. But it is
taking around 10 seconds for each slide. which will create a huge performance
problem.
Here I am giving some background on this issue.
I am developing the application which will create a ppt slides to jpg. So here
User will upload the ppt. But when ppt contains around 10 slides it is taking
around 100 sec which is huge impact on my application response.
Please solve this issue. Thanks in advance.
Please let me know if you have any other code which will resolve this issue.
********************************************************************************
package com.hsbc.servlet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Date;
import javax.imageio.ImageIO;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.SlideShow;
public class PPT2PNG {
public static void main(String args[]) throws Exception {
System.out.println("Start time:"+new Date());
int slidenum = 3;
float scale = 1;
String file = "WebContent/ppts/RIM-94100.ppt";
FileInputStream is = new FileInputStream(file);
SlideShow ppt = new SlideShow(is);
is.close();
Dimension pgsize = ppt.getPageSize();
int width = (int)(pgsize.width*scale);
int height = (int)(pgsize.height*scale);
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
if (slidenum != -1 && slidenum != (i+1)) continue;
String title = slide[i].getTitle();
System.out.println("Rendering slide "+slide[i].getSlideNumber() +
(title == null ? "" : ": " + title));
BufferedImage img = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setPaint(Color.white);
graphics.fill(new Rectangle2D.Float(0, 0, width, height));
graphics.scale((double)width/pgsize.width,
(double)height/pgsize.height);
slide[i].draw(graphics);
String fname = file.replaceAll("\\.ppt", "-" + (i+1) + ".png");
FileOutputStream out = new FileOutputStream(fname);
ImageIO.write(img, "png", out);
out.close();
}
System.out.println("End Time:"+new Date());
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 46196] Performance problem while converting the ppt slide to
png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
Using the latest version of POI (3.11-beta2) and the current version of
PPT2PNG from the examples area, all 4 slides together are converted in less
than 3 seconds, so it seems this was improved greatly since the bug was
reported.
Therefore I am closing this as WORKSFORME for now, please reopen if this still
takes a long time for you with the latest version of POI.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46196] Performance problem while converting the
ppt slide to png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2008-11-16 05:47:32 PST ---
What is your hardware configuration? How much memory do you allocate for JVM?
Can you upload a sample ppt that demonstrate the performance issue?
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46196] Performance problem while converting the
ppt slide to png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
--- Comment #2 from Raghunath Chakinam <ch...@yahoo.com> 2008-11-23 20:28:49 PST ---
Created an attachment (id=22918)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=22918)
Sample ppt to convert them into jpeg/png
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46196] Performance problem while converting the
ppt slide to png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
Raghunath Chakinam <ch...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ch_raghu_nath@yahoo.com
Status|NEEDINFO |NEW
--- Comment #3 from Raghunath Chakinam <ch...@yahoo.com> 2008-11-23 20:32:51 PST ---
Here I am sending my Hardware configuration:
CPU : Intel core2 duo processor @ 2.33GHz
RAM : 2GB
Hard Drive has 40GB Free space
I am using RAD 7.0.0.2 to run this application.
I have allocated the maximum amount of memory to JVM by specifying the max
parameters.
Thanks in advance.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46196] Performance problem while converting the
ppt slide to png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
--- Comment #4 from Raghunath Chakinam <ch...@yahoo.com> 2008-12-15 04:38:14 PST ---
Is there any update on this issue?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46196] Performance problem while converting the
ppt slide to png/jpg
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46196
--- Comment #5 from Yegor Kozlov <ye...@dinom.ru> 2008-12-16 07:49:00 PST ---
(In reply to comment #4)
> Is there any update on this issue?
>
not yet.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org