Created attachment 36499 [details] This is the power point that we use and the results from running them through poi. When we run a power point through the xslf it changes the font sizes and colors. This results in the text boxes being misaligned or moved. We appreciate any help with this.
Created attachment 37259 [details] PowerPoint presentation containing one text field containing one paragraph having the issue.
Used PowerPoint presentation, see attachment. This only contains one text field containing one paragraph having the issue. Used Code: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.FileInputStream; import java.io.FileOutputStream; import javax.imageio.ImageIO; import org.apache.poi.xslf.usermodel.XMLSlideShow; import org.apache.poi.xslf.usermodel.XSLFSlide; import java.util.List; public class PptToImageSimplest { public static void main(String args[]) throws Exception { FileInputStream in =new FileInputStream("PPT.pptx"); XMLSlideShow ppt = new XMLSlideShow(in); //get the dimension of size of the slide Dimension pgsize = ppt.getPageSize(); //get slides List<XSLFSlide> slides = ppt.getSlides(); BufferedImage img = null; FileOutputStream out = null; for (int i = 0; i < slides.size(); i++) { img = new BufferedImage((int)Math.ceil(pgsize.width), (int)Math.ceil(pgsize.height), BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); //clear the drawing area graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); //render slides.get(i).draw(graphics); //creating an image file as output out = new FileOutputStream("ppt_image_" + i + ".png"); ImageIO.write(img, "png", out); out.close(); } } } Problem: Apache POI .draw(graphics) does not draw the first text run in text field properly. Reason: The text field contains a paragraph which uses Default Run Properties in Paragraph Properties. The first text run has no Run Properties of it's own. XML looks like: <a:p> <a:pPr> <a:defRPr lang="de-DE" sz="4000" dirty="0" err="1" smtClean="0"> <a:solidFill> <a:srgbClr val="FF0000"/> </a:solidFill> </a:defRPr> </a:pPr> <a:r> <a:t>DefaultRunProperties </a:t> </a:r> <a:r> <a:rPr lang="de-DE" sz="4000" dirty="0" err="1" smtClean="0"> <a:solidFill> <a:srgbClr val="00FF00"/> </a:solidFill> </a:rPr> <a:t>ExplicitRunProperties</a:t> </a:r> </a:p> PowerPoint renders it so that first run inherits the defRP. But Apache POI does not.
Created attachment 37262 [details] PPT file used for conversion
Created attachment 37263 [details] generated image
Created attachment 37271 [details] PPTx To image through Spire java libraries the same PPTx converted through Spire java libraries is producing the correct output.
applied via r1878492 various fixes to HSLF moved line spacing to the following line refactored PropertyFetcher with lambdas
Regarding r1878492, Is there any maven release for this bug fix ?
(In reply to jitendra from comment #7) > Regarding r1878492, Is there any maven release for this bug fix ? No ... the next official release (5.0.0) won't be available for the next few weeks, as we work on providing a modular (jigsaw) version. Either you download a nightly and install it (http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html) or you download the source and call "ant mvn-install"
I tried the 5.0 jars and it resolved the problem(text overlapping) i have reported.
Hi Team, May I know if there is any planned time for Apache POI 5.0 release ?
The 5.0.0 release is due to December '20. As this was commented as resolved - I'm now closing it.