https://issues.apache.org/ooo/show_bug.cgi?id=125190

--- Comment #3 from schlocke <[email protected]> ---
This workaround just writes the embedded jpg content to an external file (java
code):

          Pattern p =
Pattern.compile("src=\"data\\:image/jpeg;base64,([A-Za-z0-9\\+/]+)\"");
          Matcher m = p.matcher(htmlContent);
          StringBuffer n = new StringBuffer(htmlContent.length());
          int i = 0;
          while (m.find())
          {
            String s = m.group(1);
            byte[] bytes = Base64.decode(s);
            File picTmpFile = Komet3Tools.getTempFile("jpg");
            FileUtils.writeByteArrayToFile(picTmpFile, bytes);
            n.append(htmlContent.substring(i, m.start()));
            i = m.end();
            n.append("src=\"").append(picTmpFile.getName()).append("\"");
          }
          n.append(htmlContent.substring(i));
          htmlContent = n.toString();

- htmlContent is the html file as a String
- Komet3Tools.getTools.getTempFile("jpg") return a temporäry file with
extension .jpg
- Base64 is a simple base64-decoder

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

Reply via email to