Skip to content

Commit 5a3cd8a

Browse files
authored
Add base64 image support with docx rendering (#397)
issue-257
1 parent 052a1f7 commit 5a3cd8a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/internal/CoreNodeDocxRenderer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,10 @@ private R renderImage(DocxRendererContext docx, String url, Attributes attribute
18091809
url = this.getClass().getResource("/emoji/" + url.substring(DocxRenderer.EMOJI_RESOURCE_PREFIX.length())).toString();
18101810
}
18111811

1812-
if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {
1812+
1813+
if (ImageUtils.isEncodedImage(url)) {
1814+
image = ImageUtils.base64Decode(url);
1815+
} else if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {
18131816
// hyperlinked image or file
18141817
if (url.startsWith("file:")) {
18151818
// try to load from file, from URL fails on some images while file load succeeds

0 commit comments

Comments
 (0)