From 244ed7482aedf44a8afccc7b2f7f77c977974f82 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 27 Mar 2017 19:20:19 +0100 Subject: Add custom image converters --- src/main/java/org/zwobble/mammoth/DocumentConverter.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/org/zwobble/mammoth/DocumentConverter.java') diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java index feba5ac..2dea8e8 100644 --- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java +++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java @@ -1,5 +1,6 @@ package org.zwobble.mammoth; +import org.zwobble.mammoth.images.ImageConverter; import org.zwobble.mammoth.internal.InternalDocumentConverter; import org.zwobble.mammoth.internal.conversion.DocumentToHtmlOptions; @@ -59,6 +60,14 @@ public class DocumentConverter { return new DocumentConverter(options.disableEmbeddedStyleMap()); } + /** + * By default, images are converted to {@code } elements with the source included inline in the {@code src} attribute. + * Call this to change how images are converted. + */ + public DocumentConverter imageConverter(ImageConverter.ImgElement imageConverter) { + return new DocumentConverter(options.imageConverter(imageConverter)); + } + /** * Converts {@code stream} into an HTML string. * Note that using this method instead of {@link #convertToHtml(File file)} -- cgit v1.2.3