Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

TestPPTX2PNG.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * ====================================================================
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. * ====================================================================
  18. */
  19. package org.apache.poi.xslf.usermodel;
  20. import junit.framework.TestCase;
  21. import org.apache.poi.xslf.XSLFTestDataSamples;
  22. import java.awt.Dimension;
  23. import java.awt.Graphics2D;
  24. import java.awt.image.BufferedImage;
  25. /**
  26. * Date: 10/26/11
  27. *
  28. * @author Yegor Kozlov
  29. */
  30. public class TestPPTX2PNG extends TestCase {
  31. public void testRender(){
  32. String[] testFiles = {"layouts.pptx", "sample.pptx", "shapes.pptx",
  33. "themes.pptx", "backgrounds.pptx"};
  34. for(String sampleFile : testFiles){
  35. XMLSlideShow pptx = XSLFTestDataSamples.openSampleDocument(sampleFile);
  36. Dimension pg = pptx.getPageSize();
  37. for(XSLFSlide slide : pptx.getSlides()){
  38. BufferedImage img = new BufferedImage(pg.width, pg.height, BufferedImage.TYPE_INT_RGB);
  39. Graphics2D graphics = img.createGraphics();
  40. slide.draw(graphics);
  41. }
  42. }
  43. }
  44. }