public class TextTokenUtil extends Object
Copyright (c) 2020 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 |
---|
TextTokenUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
getTextForToken(Object token,
PDFont font)
获取文本
|
static String |
getTextForTokenInfo(TextTokenInfo info)
获取文本
|
static Map<org.apache.pdfbox.cos.COSName,PDFont> |
initResourceFontMap(org.apache.pdfbox.pdmodel.PDResources resources)
初始化资源字体字典
|
static List<TextTokenInfo> |
initTextTokenInfoListForCharacter(org.apache.commons.logging.Log log,
org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens,
List<ReplaceInfo> replaceList,
Map<Character,Integer> replaceIndexMap)
初始化文本标记信息列表
|
static List<TextTokenInfo> |
initTextTokenInfoListForString(org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens)
初始化文本标记信息列表
|
static void |
initTextTokenInfoTextValue(org.apache.commons.logging.Log log,
TextTokenInfo tokenInfo,
Object token,
int tokenIndex,
List<ReplaceInfo> replaceList,
Map<Character,Integer> replaceIndexMap)
初始化文本标记值
|
static void |
joinString(StringBuilder builder,
Object token,
PDFont font)
拼接字符串
|
static void |
processNotSameLengthReplaceText(PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
PDFont font,
TextTokenInfo info,
String replaceText)
处理不同长度替换文本
|
static void |
processReplaceText(PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
PDFont font,
Object token,
String value)
处理替换文本
|
static void |
processSameLengthReplaceText(PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
PDFont font,
TextTokenInfo info,
String replaceText)
处理相同长度替换文本
|
static boolean |
replaceTextForToken(org.apache.commons.logging.Log log,
PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens,
List<ReplaceInfo> replaceList,
Map<Character,Integer> replaceIndexMap)
替换文本标记
|
static boolean |
replaceTextForToken(org.apache.commons.logging.Log log,
PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens,
PDFont font,
Map<String,String> replaceMap)
替换文本
|
static boolean |
tryReplaceTextForNormal(org.apache.commons.logging.Log log,
PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens,
PDFont font,
Map<String,String> replaceMap)
尝试替换正常文本
|
static boolean |
tryReplaceTextForSpecial(org.apache.commons.logging.Log log,
PDDocument document,
org.apache.pdfbox.pdmodel.PDResources resources,
List<Object> tokens,
PDFont font,
Map<String,String> replaceMap)
尝试替换特殊文本
|
public static boolean replaceTextForToken(org.apache.commons.logging.Log log, PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens, List<ReplaceInfo> replaceList, Map<Character,Integer> replaceIndexMap)
log
- 日志document
- 文档resources
- 页面资源tokens
- 标记列表replaceList
- 替换列表replaceIndexMap
- 替换索引字典public static boolean replaceTextForToken(org.apache.commons.logging.Log log, PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens, PDFont font, Map<String,String> replaceMap)
log
- 日志document
- 文档resources
- 页面资源tokens
- 标记列表font
- 替换字体replaceMap
- 替换字典public static boolean tryReplaceTextForNormal(org.apache.commons.logging.Log log, PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens, PDFont font, Map<String,String> replaceMap)
log
- 日志document
- 文档resources
- 页面资源tokens
- 标记列表font
- 替换字体replaceMap
- 替换字典public static boolean tryReplaceTextForSpecial(org.apache.commons.logging.Log log, PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens, PDFont font, Map<String,String> replaceMap)
log
- 日志document
- 文档resources
- 页面资源tokens
- 标记列表font
- 替换字体replaceMap
- 替换字典public static void processSameLengthReplaceText(PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, PDFont font, TextTokenInfo info, String replaceText)
document
- 文档resources
- 页面资源font
- 替换字体info
- 文本标记信息replaceText
- 替换文本public static void processNotSameLengthReplaceText(PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, PDFont font, TextTokenInfo info, String replaceText)
document
- 文档resources
- 页面资源font
- 替换字体info
- 文本标记信息replaceText
- 替换文本public static void processReplaceText(PDDocument document, org.apache.pdfbox.pdmodel.PDResources resources, PDFont font, Object token, String value)
document
- 文档resources
- 页面资源font
- 替换字体token
- 标记value
- 文本public static List<TextTokenInfo> initTextTokenInfoListForCharacter(org.apache.commons.logging.Log log, org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens, List<ReplaceInfo> replaceList, Map<Character,Integer> replaceIndexMap)
log
- 日志resources
- 页面资源tokens
- 标记列表replaceList
- 替换列表replaceIndexMap
- 替换索引字典public static List<TextTokenInfo> initTextTokenInfoListForString(org.apache.pdfbox.pdmodel.PDResources resources, List<Object> tokens)
resources
- 页面资源tokens
- 标记列表public static void initTextTokenInfoTextValue(org.apache.commons.logging.Log log, TextTokenInfo tokenInfo, Object token, int tokenIndex, List<ReplaceInfo> replaceList, Map<Character,Integer> replaceIndexMap)
log
- 日志tokenInfo
- 标记信息token
- 标记tokenIndex
- 标记索引replaceList
- 替换列表replaceIndexMap
- 替换索引字典public static String getTextForToken(Object token, PDFont font)
token
- 标记font
- 字体public static String getTextForTokenInfo(TextTokenInfo info)
info
- 文本标记信息public static Map<org.apache.pdfbox.cos.COSName,PDFont> initResourceFontMap(org.apache.pdfbox.pdmodel.PDResources resources)
resources
- 页面资源public static void joinString(StringBuilder builder, Object token, PDFont font)
builder
- 构建器token
- 标记font
- 字体Copyright © 2024. All rights reserved.