admin管理员组文章数量:1317909
I am converting xhtml to docx using doc4j. I would like to produce docx from simple xhtml, which includes an image. The relevant part of the input is:
<p> and a big picture with css style width:100%;:</p>
<img style="width:100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABm0AAAExCAYAA..." />
The image has significant width thus the width:100% setting to accommodate it.
My code is as follows:
String xhtmlText = addDoctype(pXHTML);
WordprocessingMLPackage wordMLPackageXHTML = WordprocessingMLPackage.createPackage();
XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackageXHTML); wordMLPackageXHTML.getMainDocumentPart().getContent().addAll(XHTMLImporter.convert(xhtmlText, null));
Save saveToZip = new Save(wordMLPackageXHTML);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
saveToZip.save(byteArrayOutputStream);
In the resulting docx file, the big image is not scaled down according to the width:100%
setting but is cut off from the right side. How can the picture be displayed completely?
本文标签: javaTransformation of xhtml to docx using docx4j doesn39t scale down an imageStack Overflow
版权声明:本文标题:java - Transformation of xhtml to docx using docx4j doesn't scale down an image - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742026411a2415624.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论