[Bug 64693] New: POI HwmfGraphics cannot read the embedded document title

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

[Bug 64693] New: POI HwmfGraphics cannot read the embedded document title

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

            Bug ID: 64693
           Summary: POI HwmfGraphics cannot read the embedded document
                    title
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

I use the org.apache.poi.xslf.util.PPTX2PNG to convert the ppt file into a png
file;  but the XSLFSlide's draw method cannot draw the Chinese charset
correctly when the ppt contains an embedded file, and the embedded  file's
title contains Chinese charset.  the embedded  file's title in the converted
image file is garbled.

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
             Status|NEW                         |NEEDINFO

--- Comment #1 from Andreas Beeker <[hidden email]> ---
Please add the ppt file and optionally a png/jpg file rendered with Office.
If the ppt/wmf uses a special font, which I can't google&download, then please
also attach it.

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

Lee <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #2 from Lee <[hidden email]> ---
Created attachment 37411
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37411&action=edit
the orignal  document

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEEDINFO                    |RESOLVED

--- Comment #3 from Andreas Beeker <[hidden email]> ---
fixed via r1881322

The problem with WMF is, that the bytes in the ExtTextOut records are depending
on the used font and it usually configured to use the default charset which is
depending on the system locale. [1]

Therefore I've introduced a charset option, which can be either set ...
- via a rendering hint:
graphics.setRenderingHint(Drawable.DEFAULT_CHARSET, Charset.forName("GBK"));
- or directly set it in the HwmfPicture/HemfPicture via:
HwmfPicture.setDefaultCharset(Charset.forName("GBK"))

The rendering hint is necessary to pass the option when rendering slides and no
direct access to the Hwmf/Hemf classes is possible.
The direct access to Hwmf/Hemf can be used, when extracting text from the
records.

To simplify the handling, I've added a "-charset" option to PPTX2PNG - so in
your case, you need to add "-charset GBK"

Apart of that I've fixed some deprecated API usage, detailed the output on
GenericRecordJsonWriter on BufferedImages and fixed some of the image
composition raster operations, i.e. the icon has a transparent background
instead of a black one.



[1]
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/0d0b32ac-a836-4bd2-a112-b6000a1b4fc9

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

--- Comment #4 from Lee <[hidden email]> ---
Hi, thank you for your reply!

I tried the newest code and use the PPTX2PNG -charset, but the embedded file
cannot be display, i cannot see the icon and title in the saved image file.



(In reply to Andreas Beeker from comment #3)

> fixed via r1881322
>
> The problem with WMF is, that the bytes in the ExtTextOut records are
> depending on the used font and it usually configured to use the default
> charset which is depending on the system locale. [1]
>
> Therefore I've introduced a charset option, which can be either set ...
> - via a rendering hint:
> graphics.setRenderingHint(Drawable.DEFAULT_CHARSET, Charset.forName("GBK"));
> - or directly set it in the HwmfPicture/HemfPicture via:
> HwmfPicture.setDefaultCharset(Charset.forName("GBK"))
>
> The rendering hint is necessary to pass the option when rendering slides and
> no direct access to the Hwmf/Hemf classes is possible.
> The direct access to Hwmf/Hemf can be used, when extracting text from the
> records.
>
> To simplify the handling, I've added a "-charset" option to PPTX2PNG - so in
> your case, you need to add "-charset GBK"
>
> Apart of that I've fixed some deprecated API usage, detailed the output on
> GenericRecordJsonWriter on BufferedImages and fixed some of the image
> composition raster operations, i.e. the icon has a transparent background
> instead of a black one.
>
>
>
> [1]
> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/0d0b32ac-
> a836-4bd2-a112-b6000a1b4fc9

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

Lee <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

--- Comment #5 from Lee <[hidden email]> ---
Created attachment 37420
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37420&action=edit
the converted img file

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

--- Comment #6 from Andreas Beeker <[hidden email]> ---
My guess is, you forgot to include the scratchpad and the "provided" jars,
which contains the WMF renderer.

While trying to describe below, I found out, that the PPTX2PNG argument
handling is case-sensitive and so doesn't match the docs, but apart of that it
works for me. I think we should also add the "provided" jars to the binary
bundle, as this will be less pain for the users and nobody cares nowadays about
a increase in the bundle size.


- Download and unzip the nightly:
https://ci-builds.apache.org/job/POI/job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/dist/

- Download the "provided" jars and put them in the directory "provided":
https://search.maven.org/artifact/org.apache.xmlgraphics/batik-all/1.13/pom
https://search.maven.org/artifact/xml-apis/xml-apis-ext/1.3.04/jar
https://search.maven.org/artifact/org.apache.xmlgraphics/xmlgraphics-commons/2.4/jar

- Execute the java command (Unix-paths needs to be replaced for Windows):
java -cp
poi-5.0.0-SNAPSHOT.jar:poi-ooxml-5.0.0-SNAPSHOT.jar:poi-ooxml-schemas-5.0.0-SNAPSHOT.jar:poi-scratchpad-5.0.0-SNAPSHOT.jar:lib/*:ooxml-lib/*:provided/*
org.apache.poi.xslf.util.PPTX2PNG -format png -fixside long -scale 1000
-charset GBK -outdir . ttt.pptx

--
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 64693] POI HwmfGraphics cannot read the embedded document title

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

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Andreas Beeker <[hidden email]> ---
Added the "provided" jars to the binary bundle.
Ignore case in PPTX2PNG argument handling.
added instructions to the renderer docs.

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