https://issues.apache.org/bugzilla/show_bug.cgi?id=54210
Bug ID: 54210
Summary: When saving PPT to PNG, some text is rendered
backwards
Product: POI
Version: 3.8
Hardware: PC
Status: NEW
Severity: critical
Priority: P2
Component: HSLF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Created attachment 29643
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29643&action=edit
This zip contains the PPT file and the PNG image resulting from the code above
When converting the attached PPT file with HSLF, and the code below, some of
the text (but not all of it) is rendered as if seen in a mirror (see the PNG
file attached).
Code snippet:
InputStream is = getInputStream(); //A FileInputStream on the ppt file
SlideShow ppt = new SlideShow(is);
Dimension pgsize = ppt.getPageSize();
double scaleW = (double)TARGET_WIDTH / (double)pgsize.width;
double scaleH = (double)TARGET_HEIGHT / (double)pgsize.height;
double scale = Math.min(scaleW, scaleH);
int width = (int) (pgsize.width * scale);
int height = (int) (pgsize.height * scale);
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++)
{
BufferedImage img = new BufferedImage(width, height,
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.clearRect(0, 0, width, height);
graphics.scale((double)width/pgsize.width, (double)height/pgsize.height);
slide[i].draw(graphics);
// save the result
File image = new File(root, "slide"+Integer.toString(i)+".png");
ImageIO.write(img, "png", image);
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]