public class Html2ImageUtils
extends java.lang.Object
构造器和说明 |
---|
Html2ImageUtils() |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
clipHtmlContent(java.lang.Object value,
Style style,
java.awt.Rectangle primitiveArea,
int resolution,
int startY,
int endY)
切割pdfContainer,获取切割后的pdfLines并转换成原始html
|
static java.lang.String |
convertPt2Px(java.lang.String htmlStr)
将Html内容中的pt转为px
|
static java.lang.String |
convertPx2Pt(java.lang.String htmlStr)
将Html内容中的px转为pt
|
static java.awt.image.BufferedImage |
createHTMLContentBufferedImage(java.lang.String value,
java.awt.Rectangle paintRectangle,
int x,
int y,
Style style)
如果用户希望以HTML方式展示String,导出word, web端展示时value转化图片,
打印的时候, 转为HTMLPainter, 避免绘制多次导致模糊
|
static float |
getContainerWidth(int width,
Style style,
int resolution)
根据设置的样式获取container的宽度
|
static UNIT |
getHtmlHeight(java.lang.String content,
UNIT paintWidth,
Style style)
获取限定宽度下html内容的高度
|
static UNIT |
getHtmlWidth(java.lang.String content,
UNIT paintHeight,
Style style)
获取限定高度下html内容的宽度
|
static PdfContainer |
html2PdfContainer(java.lang.String content,
int width,
int height,
Style style,
int resolution)
将html转换成pdf对象,用于计算和绘制
|
static void |
paintOnJEditorPane(java.lang.String htmlStr,
java.awt.Graphics2D g2d,
int width,
Style style)
将指定的html内容paint到JEditorPane中
|
public static UNIT getHtmlHeight(java.lang.String content, UNIT paintWidth, Style style)
content
- 指定的html内容paintWidth
- 限定的宽度public static UNIT getHtmlWidth(java.lang.String content, UNIT paintHeight, Style style)
content
- 指定的html内容paintHeight
- 限定的高度public static java.awt.image.BufferedImage createHTMLContentBufferedImage(java.lang.String value, java.awt.Rectangle paintRectangle, int x, int y, Style style)
value
- 值paintRectangle
- 绘制范围x
- x坐标y
- y坐标style
- 样式public static void paintOnJEditorPane(java.lang.String htmlStr, java.awt.Graphics2D g2d, int width, Style style)
htmlStr
- 指定的html内容g2d
- 画板width
- 限定的宽度public static java.lang.String convertPt2Px(java.lang.String htmlStr)
htmlStr
- html内容public static java.lang.String convertPx2Pt(java.lang.String htmlStr)
htmlStr
- html内容public static PdfContainer html2PdfContainer(java.lang.String content, int width, int height, Style style, int resolution)
content
- 待转换的htmlwidth
- 绘制宽度height
- 绘制高度style
- 单元格样式resolution
- 分辨率public static float getContainerWidth(int width, Style style, int resolution)
width
- 绘制宽度style
- 单元格样式resolution
- 分辨率public static java.lang.String clipHtmlContent(java.lang.Object value, Style style, java.awt.Rectangle primitiveArea, int resolution, int startY, int endY)
value
- 原始html值style
- 单元格样式primitiveArea
- 单元格尺寸resolution
- 分辨率startY
- 起始Y坐标endY
- 终止Y坐标