poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 52078] Slide.draw throws java.lang.OutOfMemoryError in some slides with grouped shapes
Date Fri, 16 Nov 2012 12:08:49 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52078

--- Comment #5 from Yegor Kozlov <yegor@dinom.ru> ---
To get Picture objects from a slide you need to iterate over the shapes and
check if a shape is an instance of Picture, see example at
http://poi.apache.org/slideshow/how-to-shapes.html#Pictures


(In reply to comment #4)
> OK, i saw it, but i don't understand how can I get the Picture
> object(parent) in BitmapPainter.paint(Graphics2D graphics, PictureData pict,
> Picture parent) method?
> I put my method that returns a list of strings(the BufferedImage converted
> in base64) --> one string for one slide
> 
> /***************************************************/
> private List<String> obtainSlidesFromPPT(InputStream is) {
> 	SlideShow ppt = null;
> 	List<String> returnList = new LinkedList<String>();
> 	try {
> 		ppt = new SlideShow(is);
> 		is.close();
> 		Dimension pgsize = ppt.getPageSize();
> 		PictureData [] pd = ppt.getPictureData();
> 		int nSlides = pd.length;
> 		for (int i = 0; i < nSlides; i++) {
> 			PictureData pict = pd[i];
> 			BufferedImage img = ImageIO.read(new
> ByteArrayInputStream(pict.getData()));
> 			Graphics2D graphics = img.createGraphics();
> 			//Rectangle anchor = parent.getLogicalAnchor2D().getBounds();
> 			 graphics.drawImage(img, anchor.x, anchor.y, anchor.width, anchor.height,
> null);
> 			graphics.dispose();			
> returnList.add(covertBufferedImageInBase64String(img));		
> 			}
> 		} catch (IOException ioe) {
> 			System.err.println(ioe.getMessage());
> 		}
> 		return returnList;
> 	}
> /***************************************************/
> 
> 
> (In reply to comment #3)
> > Did you try the latest build from trunk? Does it still throw OutOfMemory for
> > the attached file?
> > 
> > (In reply to comment #2)
> > > Why Status is RESOLVED? I didn't find the solution!
> > > Please, can show me?
> > > 
> > > Thanks

-- 
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


Mime
View raw message