List of usage examples for org.apache.poi.hslf.usermodel HSLFSlide getSlideNumber
@Override public int getSlideNumber()
From source file:com.github.codeurjc.slidesconverter.PowerPointToHTML.java
License:Apache License
private String calculateSubtitle(XSLFSlide slideX, HSLFSlide slide) { if (isContentSlide(slide.getSlideNumber())) { return null; }/*from ww w .ja v a 2 s . com*/ for (XSLFShape shape : slideX.getShapes()) { if (shape instanceof XSLFTextShape) { XSLFTextShape tsh = (XSLFTextShape) shape; Rectangle2D figure = getRelativeFigure(tsh); if (figure.getY() < 0.1) { continue; } for (XSLFTextParagraph p : tsh) { for (XSLFTextRun r : p) { return r.getRawText(); } } return null; } } return null; }
From source file:com.github.codeurjc.slidesconverter.PowerPointToHTML.java
License:Apache License
public void generateSlideImage(HSLFSlide slide) throws IOException { float scale = 0.5f; int sWidth = (int) (width * scale); int sHeight = (int) (height * scale); String title = slide.getTitle(); System.out.println("Rendering slide " + slide.getSlideNumber() + (title == null ? "" : ": " + title)); BufferedImage img = new BufferedImage(sWidth, sHeight, 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, sWidth, sHeight)); graphics.scale((double) sWidth / width, (double) sHeight / height); try {/* w ww . j a v a 2 s . c om*/ slide.draw(graphics); Path imagePath = htmlFile.getParent().resolve(Paths.get(getImageFileName(slide.getSlideNumber()))); OutputStream out = Files.newOutputStream(imagePath); ImageIO.write(img, "png", out); out.close(); } catch (Exception e) { System.err.println("Exception rendering slide " + slide.getSlideNumber() + ": " + title); } }