public abstract class AbstractTextHandler extends AbstractExpander
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.
document, log
Constructor and Description |
---|
AbstractTextHandler(Document document)
有参构造
|
Modifier and Type | Method and Description |
---|---|
protected Context |
getContext()
获取上下文
|
float |
getTextHeight(FontConfiguration fontConfiguration,
int rowCount)
获取文本高度
|
float |
getTextWidth(FontConfiguration fontConfiguration,
String text)
获取文本宽度
|
List<TextLineInfo> |
splitLines(FontConfiguration fontConfiguration,
String text,
float lineWidth)
拆分文本段落(换行)
|
TextLineInfo |
splitText(FontConfiguration fontConfiguration,
String text,
float lineWidth)
拆分文本(单行)
|
abstract void |
writeText(FontConfiguration fontConfiguration,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
TextLineInfo text)
写入文本
|
getDocument
public AbstractTextHandler(Document document)
document
- 文档public abstract void writeText(FontConfiguration fontConfiguration, org.apache.pdfbox.pdmodel.PDPageContentStream contentStream, TextLineInfo text)
fontConfiguration
- 字体配置contentStream
- 内容流text
- 文本public TextLineInfo splitText(FontConfiguration fontConfiguration, String text, float lineWidth)
fontConfiguration
- 字体配置text
- 文本lineWidth
- 行宽public List<TextLineInfo> splitLines(FontConfiguration fontConfiguration, String text, float lineWidth)
fontConfiguration
- 字体配置text
- 文本lineWidth
- 行宽public float getTextWidth(FontConfiguration fontConfiguration, String text)
fontConfiguration
- 字体配置text
- 文本public float getTextHeight(FontConfiguration fontConfiguration, int rowCount)
fontConfiguration
- 字体配置rowCount
- 行数protected Context getContext()
Copyright © 2024. All rights reserved.