Created attachment 22250 [details] Sampe ppt for the bug Following code is for reading a line in the ppt and converting to a graphics object. // Read all shapes ... if (type == ShapeTypes.Line) { Line l = (Line)s; Rectangle a = l.getAnchor(); int w = a.width; int h = a.height; double x = a.getX(); double y = a.getY(); BufferedImage img = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB); Graphics2D g = img.createGraphics(); l.draw(graphics); // ... Draw the image } The issue is the height and width returned from anchor is smaller that actual size. If a ppt has a table, the table is drawn half.
Anchor doesn't take into account the line width. If you want to draw individual lines you need to set the image dimensions as max(linewidth, anchor.width) and max(linewidth, anchor.height): Rectangle2D a = l.getAnchor2D(); double w = Math.max(a.getWidth(), l.getLineWidth()); double h = Math.max(a.getHeight(), l.getLineWidth()); BufferedImage img = new BufferedImage((int) Math.round(w), (int) Math.round(h), BufferedImage.TYPE_INT_RGB); Regards, Yegor