You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/08/29 04:17:16 UTC

[Bug 54880] Problem with Chinese characters

https://issues.apache.org/bugzilla/show_bug.cgi?id=54880

saiyedzahid@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|HSLF                        |XSLF
           Hardware|PC                          |Other
            Version|unspecified                 |3.9

--- Comment #2 from saiyedzahid@gmail.com ---
Please refer this stackflow quuestion. 

This is my code. But when I convert PPTX to PNG - it does not convert unicode
character properly. It convert unicode characters to a rectangle box. I am
attaching the pptx file I am using for my below program. 

package foo;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;

public class PptToPng {
    public static void main(String[] args) throws Exception {

        FileInputStream is = new
FileInputStream("C:/Temp/aspose/word/font_test.pptx");
        XMLSlideShow ppt = new XMLSlideShow(is);
        is.close();
        double zoom = 2; // magnify it by 2
        AffineTransform at = new AffineTransform();
        at.setToScale(zoom, zoom);
        Dimension pgsize = ppt.getPageSize();
        System.out.println("DONE1");
        XSLFSlide[] slide = ppt.getSlides();
        System.out.println("DONE2");
        //for (int i = 0; i < slide.length; i++) {
            BufferedImage img = new
BufferedImage((int)Math.ceil(pgsize.width*zoom),
(int)Math.ceil(pgsize.height*zoom), BufferedImage.TYPE_INT_RGB);
            Graphics2D graphics = img.createGraphics();
            graphics.setTransform(at);
            System.out.println("DONE3");
            graphics.setPaint(Color.white);
            graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width,
pgsize.height));
            slide[0].draw(graphics);
            System.out.println("DONE4");
            FileOutputStream out = new
FileOutputStream("C:/Temp/aspose/word/slide-" + (10 + 1) + ".png");        
            System.out.println("DONE5");   
            javax.imageio.ImageIO.write(img, "png", out);
            out.close();
            System.out.println("DONE");
       // }
    }
}

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