[Bug 63290] New: PPTX To Png changes font sizes and colors

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 63290] New: PPTX To Png changes font sizes and colors

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63290

            Bug ID: 63290
           Summary: PPTX To Png changes font sizes and colors
           Product: POI
           Version: 4.0.x-dev
          Hardware: Macintosh
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 36499
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36499&action=edit
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.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63290] PPTX To Png changes font sizes and colors

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63290

--- Comment #1 from Axel Richter <[hidden email]> ---
Created attachment 37259
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37259&action=edit
PowerPoint presentation containing one text field containing one paragraph
having the issue.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63290] PPTX To Png changes font sizes and colors

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63290

--- Comment #2 from Axel Richter <[hidden email]> ---
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.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63290] PPTX To Png changes font sizes and colors

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63290

--- Comment #3 from jitendra <[hidden email]> ---
Created attachment 37262
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37262&action=edit
PPT file used for conversion

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63290] PPTX To Png changes font sizes and colors

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63290

--- Comment #4 from jitendra <[hidden email]> ---
Created attachment 37263
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37263&action=edit
generated image

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]