public class CommonUtil extends Object
Copyright (c) 2020-2024 xsx All Rights Reserved. x-easypdf-pdfbox is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
Constructor and Description |
---|
CommonUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addBackgroundColor(Context context,
ContentMode mode,
boolean isResetContentStream,
org.apache.pdfbox.pdmodel.common.PDRectangle rectangle,
Color backgroundColor)
添加背景颜色
|
static int[] |
createIntArray(int size)
创建基本整型数组
|
static void |
extractImage(List<BufferedImage> list,
org.apache.pdfbox.pdmodel.PDResources resources)
提取图像
|
static List<BufferedImage> |
extractImage(org.apache.pdfbox.pdmodel.PDPage page)
提取图像
|
static org.apache.pdfbox.pdmodel.common.PDRectangle |
getRectangle(float width,
float height)
获取行尺寸
|
static org.apache.pdfbox.pdmodel.common.PDRectangle |
getRectangle(float beginX,
float beginY,
float width,
float height)
获取行尺寸
|
static void |
initFontColorAndAlpha(org.apache.pdfbox.pdmodel.PDPageContentStream stream,
Color backgroundColor,
FontStyle fontStyle,
Color fontColor,
Color strokColor,
float fontAlpha)
初始化字体颜色及透明度
|
static float |
initLineWidth(FontStyle style)
初始化线宽
|
static void |
initMatrix(org.apache.pdfbox.pdmodel.PDPageContentStream stream,
float beginX,
float beginY,
float relativeBeginX,
float relativeBeginY,
float width,
float height,
float angle,
float alpha)
初始化矩阵
|
static List<Character> |
toCharacterList(char[] array)
转字符型列表
|
static double[] |
toDoubleArray(List<Double> list)
转基本双精度浮点型数组
|
static float[] |
toFloatArray(List<Float> list)
转基本浮点型数组
|
static int[] |
toIntArray(List<Integer> list)
转基本整型数组
|
public static void initFontColorAndAlpha(org.apache.pdfbox.pdmodel.PDPageContentStream stream, Color backgroundColor, FontStyle fontStyle, Color fontColor, Color strokColor, float fontAlpha)
stream
- 内容流fontStyle
- 字体样式fontColor
- 字体颜色fontColor
- 字体描边颜色fontAlpha
- 字体透明度public static void initMatrix(org.apache.pdfbox.pdmodel.PDPageContentStream stream, float beginX, float beginY, float relativeBeginX, float relativeBeginY, float width, float height, float angle, float alpha)
stream
- 内容流beginX
- X轴起始坐标beginY
- Y轴起始坐标relativeBeginX
- X轴相对起始坐标relativeBeginY
- Y轴相对起始坐标width
- 宽度height
- 高度angle
- 旋转角度alpha
- 透明度public static float initLineWidth(FontStyle style)
style
- 字体样式public static List<BufferedImage> extractImage(org.apache.pdfbox.pdmodel.PDPage page)
page
- 页面public static void extractImage(List<BufferedImage> list, org.apache.pdfbox.pdmodel.PDResources resources)
list
- 待接收图片列表resources
- 页面资源public static void addBackgroundColor(Context context, ContentMode mode, boolean isResetContentStream, org.apache.pdfbox.pdmodel.common.PDRectangle rectangle, Color backgroundColor)
context
- 上下文mode
- 内容模式isResetContentStream
- 是否重置内容流rectangle
- 矩形backgroundColor
- 背景颜色public static org.apache.pdfbox.pdmodel.common.PDRectangle getRectangle(float beginX, float beginY, float width, float height)
beginX
- X轴起始坐标beginY
- Y轴起始坐标width
- 宽度height
- 高度public static org.apache.pdfbox.pdmodel.common.PDRectangle getRectangle(float width, float height)
width
- 宽度height
- 高度public static int[] toIntArray(List<Integer> list)
list
- 列表public static float[] toFloatArray(List<Float> list)
list
- 列表public static double[] toDoubleArray(List<Double> list)
list
- 列表public static List<Character> toCharacterList(char[] array)
array
- 数组public static int[] createIntArray(int size)
size
- 大小Copyright © 2024. All rights reserved.