IDocument

所有已实现的接口: com.aspose.ms.System.IDisposable, java.io.Closeable

public interface IDocument extends System.IDisposable, Closeable

表示 PDF 文档的界面

方法

方法描述
afterImport()枚举所有已注册的注释并为每个注释调用 AfterImport。
bindXml(InputStream stream)将 xml 绑定到文档
bindXml(String file)将 xml 绑定到文档
bindXml(String xmlFile, String xslFile)将 xml/xsl 绑定到文档
changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)更改文档密码。
check(boolean doRepair)验证文档。
close()关闭此文档使用的所有资源。
convert(Document.CallBackGetHocr callback)将文档转换为可搜索的文档。
convert(Document.CallBackGetHocr callback, boolean isTestVisible)转换文档并将错误保存到指定文件中。
convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage)转换文档并将错误保存到指定文件中。
convert(PdfFormatConversionOptions options)使用指定的转换选项转换文档
convert(OutputStream outputLogStream, PdfFormat format, int action)
convert(String outputLogFileName, PdfFormat format, int action)转换文档并将错误保存到指定文件中。
convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction)转换文档并将错误保存到指定文件中。
convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none)内部方法
convertWithSkippingErrors(Document.CallBackGetHocr callback)将文档转换为可搜索文档并跳过无法转换的 hochr 错误。
decrypt()解密文档。
dispose()关闭此文档使用的所有资源。
encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, int cryptoAlgorithm, boolean usePdf20)加密文档。
encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)加密文档。
encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm, boolean usePdf20)加密文档。
exportAnnotationsToXfdf(String fileName)将所有文档注释导出到 XFDF 文件
flatten()从文档中删除所有字段并改为放置它们的值。
flatten(Form.FlattenSettings flattenSettings)从文档中删除所有字段并改为放置它们的值。
freeMemory()清除内存
getActions()获取文档操作。
getBackground()获取文档的背景颜色。
getCatalogValue(String key)从目录字典返回项目值。
getCollection()获取文档集合。
getCryptoAlgorithm()如果文档已加密,则获取安全设置。
getDefaultCopier()将用于复印页面的复印机返回到此文档。
getDestinations()获取目的地的集合。
getDirection()获取文本的阅读顺序:L2R(从左到右)或 R2L(从右到左)。
getDuplex()获取或设置从打印对话框打印文件时要使用的打印双面模式处理选项。
getEmbedStandardFonts()声明文档必须嵌入所有标准 Type1 字体的属性,该字体的标志 IsEmbedded 设置为 true。
getEmbeddedFiles()获取嵌入文档的文件集合。
getEnableSignatureSanitization()获取或设置标志以管理签名字段清理。
getEngineDoc()用于访问内部文档结构的 IPdfDocument 实例。
getFileName()生成此文档的 PDF 文件的名称
getForm()获取文档的 Acro 形式。
getId()获取ID。
getIgnoreCorruptedObjects()获取或设置忽略源文件中错误的标志。
getInfo()获取文档信息。
getLogicalStructure()获取文档的逻辑结构。
getMetadata()文档元数据。
getMetadataStream()返回原始元数据流
getNamedDestinations()文档中命名目标的集合。
getNonFullScreenPageMode()获取页面模式,指定在退出全屏模式时如何显示文档。
getObjectById(String id)获取文档中具有指定 ID 的对象。
getOpenAction()获取打开文档时执行的操作。
getOptimizeSize()获取优化标志。
getOutlines()获取文档大纲。
getPageInfo()获取页面信息。
getPageLabels()获取文档中的页面标签。
getPageLayout()获取打开文档时应使用的页面布局。
getPageMode()获取页面模式,指定打开文档时应如何显示。
getPages()获取文档页面的集合。
getPdfFormat()
getPermissions()获取文档的权限。
getVersion()从 Pdf 文件头获取 Pdf 的版本。
getXmpMetadata(OutputStream stream)从文档中获取 XMP 元数据。
importAnnotationsFromXfdf(String fileName)将注释从 XFDF 文件导入文档。
isAbsentFontTryToSubstitute()处理文档时有关丢失字体的通知
isCenterWindow()获取指定文档窗口的位置是否将在屏幕上居中的标志。
isDisableFontLicenseVerifications()如果该字体的许可证禁止这些操作,则无法执行该字体的许多操作。
isDisplayDocTitle()获取指定文档窗口标题栏是否应显示文档标题的标志。
isEncrypted()获取文档的加密状态。
isFitWindow()获取指定是否必须调整文档窗口大小以适合显示的第一个页面的标志。
isHideMenubar()获取指定在文档处于活动状态时是否应隐藏菜单栏的标志。
isHideToolBar()获取指定在文档处于活动状态时是否应隐藏工具栏的标志。
isHideWindowUI()获取或设置标志,该标志指定当文档处于活动状态时是否应隐藏用户界面元素。
isLinearized()获取或设置一个值,该值指示文档是否线性化。
isManualDisposeEnabled()默认方法保存关闭内部流并释放内存资源。
isPdfUaCompliant()获取符合 pdfua 标准的文档。
isPdfaCompliant()
isXrefGapsAllowed()获取或设置文档 pdfa 兼容。
optimize()线性化文档以便 - 尽快打开第一页; - 尽快显示下一页或通过链接进入下一页; - 当页面数据通过慢速通道传送时,在页面到达时逐步显示页面(首先显示最有用的数据); - 允许甚至在接收和显示整个页面之前执行用户交互,例如跟随链接。
optimizeResources()优化文档中的资源: 1。
optimizeResources(OptimizationOptions strategy)根据定义的优化策略优化文档中的资源。
processParagraphs()将文档存储到流中。
removeMetadata()从文档中删除元数据。
removePdfUaCompliance()从文档中删除 pdfUa 合规性
removePdfaCompliance()从文档中删除 pdfa 合规性
repair()修复损坏的文档。
恢复更新()resumeUpdate
save()增量保存文档(即使用增量更新技术)。
save(OutputStream output)将文档存储到流中。
save(OutputStream outputStream, SaveFormat format)保存文件
save(OutputStream outputStream, SaveOptions options)使用设置其保存选项的新名称保存文档。
save(String outputFileName)将文档保存到指定的文件中。
save(String outputFileName, SaveOptions options)使用设置其保存选项的新名称保存文档。
saveIncrementally(System.IO.Stream output)将 PDF 文档增量保存到指定的流。
saveIncrementally(OutputStream output)将 PDF 文档增量保存到指定的流。
saveIncrementally(String outputFileName)将 PDF 文档增量保存到指定的流。
saveXml(String file)将文档保存为 XML。
sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)将文档的某些页面发送到文档设备进行处理。
sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)将整个文档发送到文档设备进行处理。
sendTo(DocumentDevice device, OutputStream output)将整个文档发送到文档设备进行处理。
sendTo(DocumentDevice device, String outputFileName)将整个文档发送到文档设备进行处理。
setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)在没有字体的情况下,设置程序确定字体的设置标志。
setBackground(Color value)设置文档的背景颜色。
setCenterWindow(boolean value)设置标志指定文档窗口的位置是否将在屏幕上居中。
setCollection(Collection value)设置文档集合。
setConvertMetadataAndCatalogOnly(boolean value)获取 pdf/ua 转换器的转换参数(如果设置为 true,则仅转换元数据和文档目录)
setDirection(int value)设置文本的阅读顺序:L2R(从左到右)或 R2L(从右到左)。
setDisableFontLicenseVerifications(boolean value)如果该字体的许可证禁止这些操作,则无法执行该字体的许多操作。
setDisplayDocTitle(boolean value)设置标志指定文档的窗口标题栏是否应显示文档标题。
setDuplex(int value)获取或设置从打印对话框打印文件时要使用的打印双面模式处理选项。
setEmbedStandardFonts(boolean value)声明文档必须嵌入所有标准 Type1 字体的属性,该字体的标志 IsEmbedded 设置为 true。
setEnableSignatureSanitization(boolean value)获取或设置标志以管理签名字段清理。
setFitWindow(boolean value)设置标志,指定是否必须调整文档窗口的大小以适合显示的第一个页面。
setHideMenubar(boolean value)设置标志,指定当文档处于活动状态时是否应隐藏菜单栏。
setHideToolBar(boolean value)设置标志,指定在文档处于活动状态时工具栏是否应隐藏。
setHideWindowUI(boolean value)设置标志,指定在文档处于活动状态时是否应隐藏用户界面元素。
setIgnoreCorruptedObjects(boolean value)
setLayersAdded(boolean value)设置 LayersAdded 值
setLinearized(boolean value)设置一个值,指示文档是否线性化。
setManualDisposeEnabled(boolean manualDisposeEnabled)默认方法 save 关闭内部流并释放内存资源。
setNonFullScreenPageMode(int value)设置页面模式,指定在退出全屏模式时如何显示文档。
setOpenAction(IAppointment value)设置在文档打开时执行的操作。
setOptimizeSize(boolean value)设置优化标志。
setPageInfo(PageInfo value)设置页面信息。
setPageLayout(int value)设置打开文档时应使用的页面布局。
setPageMode(int value)设置页面模式,指定打开文档时应如何显示。
setTitle(String title)为 Pdf 文档设置标题
setXmpMetadata(InputStream stream)设置文档的 XMP 元数据。
setXrefGapsAllowed(boolean value)获取或设置文档 pdfa 兼容。
抑制更新()suppressUpdate
更新页面()updatePages
validate(OutputStream outputLogStream, PdfFormat format)将文档验证到指定的文件中。
validate(String outputLogFileName, PdfFormat format)将文档验证到指定的文件中。

afterImport()

public abstract void afterImport()

枚举所有已注册的注释并为每个注释调用 AfterImport。

bindXml(InputStream stream)

public abstract void bindXml(InputStream stream)

将 xml 绑定到文档

参数:

范围类型描述
streamjava.io.InputStream带有 xml 文件的流

bindXml(String file)

public abstract void bindXml(String file)

将 xml 绑定到文档

参数:

范围类型描述
filejava.lang.Stringxml文件

bindXml(String xmlFile, String xslFile)

public abstract void bindXml(String xmlFile, String xslFile)

将 xml/xsl 绑定到文档

参数:

范围类型描述
xmlFilejava.lang.Stringxml 文件。
xslFilejava.lang.String如果使用 XSLT,则为 xsl 文件。

changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)

public abstract void changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)

更改文档密码。此操作只能使用所有者密码来完成。

参数:

范围类型描述
ownerPasswordjava.lang.String所有者密码。
newUserPasswordjava.lang.String新用户密码。
newOwnerPasswordjava.lang.String新所有者密码。

check(boolean doRepair)

public abstract boolean check(boolean doRepair)

验证文档。

参数:

范围类型描述
doRepairboolean如果确实发现问题将被修复。

退货: boolean - 布尔值

close()

public abstract void close()

关闭此文档使用的所有资源。

convert(Document.CallBackGetHocr callback)

public abstract boolean convert(Document.CallBackGetHocr callback)

将文档转换为可搜索的文档。

参数:

范围类型描述
callbackCallBackGetHocrhocr 识别的回调过程。

退货: boolean - 布尔值

convert(Document.CallBackGetHocr callback, boolean isTestVisible)

public abstract boolean convert(Document.CallBackGetHocr callback, boolean isTestVisible)

转换文档并将错误保存到指定文件中。

这允许在页面上显示/隐藏可搜索文本。默认值为 FALSE。

参数:

范围类型描述
callbackCallBackGetHocr无法转换的对象的操作
isTestVisibleboolean布尔值

退货: boolean - 运算结果

convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage)

public abstract boolean convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage)

转换文档并将错误保存到指定文件中。

这允许在页面上显示/隐藏可搜索文本。默认值为 FALSE。这允许从 pdf 获取原始图像。默认值为 FALSE。

参数:

范围类型描述
callbackCallBackGetHocr无法转换的对象的操作
isTestVisibleboolean布尔值
isOriginalImageboolean布尔值

退货: boolean - 运算结果

convert(PdfFormatConversionOptions options)

public abstract boolean convert(PdfFormatConversionOptions options)

使用指定的转换选项转换文档

参数:

范围类型描述
optionsPdfFormatConversionOptions一组用于转换 PDF 文档的选项

退货: boolean - 运算结果

convert(OutputStream outputLogStream, PdfFormat format, int action)

public abstract boolean convert(OutputStream outputLogStream, PdfFormat format, int action)

参数:

范围类型描述
outputLogStreamjava.io.OutputStream
formatPdfFormat
actionint

退货: 布尔值

convert(String outputLogFileName, PdfFormat format, int action)

public abstract boolean convert(String outputLogFileName, PdfFormat format, int action)

转换文档并将错误保存到指定文件中。

参数:

范围类型描述
outputLogFileNamejava.lang.String将存储评论的文件路径。
formatPdfFormatPDF 格式。
actionint无法转换的对象的操作

退货: boolean - 运算结果

convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction)

public abstract boolean convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction)

转换文档并将错误保存到指定文件中。

参数:

范围类型描述
outputLogFileNamejava.lang.String将存储评论的文件路径。
formatPdfFormatpdf 格式。
actionint无法转换的对象的操作
transparencyActionint图像蒙版对象的操作

退货: boolean - 运算结果

convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none)

public abstract boolean convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none)

内部方法

参数:

范围类型描述
logcom.aspose.ms.System.IO.Stream内部对象
_convertToPdfFormat内部对象
noneint内部对象

退货: 布尔值 - 内部值

convertWithSkippingErrors(Document.CallBackGetHocr callback)

public abstract boolean convertWithSkippingErrors(Document.CallBackGetHocr callback)

将文档转换为可搜索文档并跳过无法转换的 hochr 错误。

参数:

范围类型描述
callbackCallBackGetHocrhocr 识别的回调过程。

退货: boolean - 布尔值

decrypt()

public abstract void decrypt()

解密文档。然后调用 Save 以获得文档的解密版本。

dispose()

public abstract void dispose()

关闭此文档使用的所有资源。

此方法已过时,请改用 close() 。

encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, int cryptoAlgorithm, boolean usePdf20)

public abstract void encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, int cryptoAlgorithm, boolean usePdf20)

加密文档。调用然后保存以获取文档的加密版本。

参数:

范围类型描述
userPasswordjava.lang.String用户密码。
ownerPasswordjava.lang.String所有者密码。
privilegesDocumentPrivilege文档权限,详见权限。
cryptoAlgorithmint密码算法,详见 CryptoAlgorithm。
usePdf20boolean支持修订版 6(扩展 8)。

encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)

public abstract void encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)

加密文档。调用然后保存以获取文档的加密版本。

参数:

范围类型描述
userPasswordjava.lang.String用户密码。
ownerPasswordjava.lang.String所有者密码。
permissionsint文档权限,详见权限。
cryptoAlgorithmint密码算法,详见 CryptoAlgorithm。

encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm, boolean usePdf20)

public abstract void encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm, boolean usePdf20)

加密文档。调用然后保存以获取文档的加密版本。

参数:

范围类型描述
userPasswordjava.lang.String用户密码。
ownerPasswordjava.lang.String所有者密码。
permissionsint文档权限,详见权限。
cryptoAlgorithmint密码算法,详见 CryptoAlgorithm。
usePdf20boolean支持修订版 6(扩展 8)。

exportAnnotationsToXfdf(String fileName)

public abstract void exportAnnotationsToXfdf(String fileName)

将所有文档注释导出到 XFDF 文件

参数:

范围类型描述
fileNamejava.lang.StringXFDF 文件名

flatten()

public abstract void flatten()

从文档中删除所有字段并改为放置它们的值。

flatten(Form.FlattenSettings flattenSettings)

public abstract void flatten(Form.FlattenSettings flattenSettings)

从文档中删除所有字段并改为放置它们的值。

参数:

范围类型描述
flattenSettingsFlattenSettings展平过程的设置。

freeMemory()

public abstract void freeMemory()

清除内存

getActions()

public abstract DocumentActionCollection getActions()

获取文档操作。此属性是 DocumentActions 类的实例,它允许获取/设置 BeforClosing、BeforSaving 等操作。


This example demonstrates how to obtain after open action of the document:

 Document document = new Document("PdfWithOpenAction.pdf");
 DocumentActions actions = document.getActions();
 com.aspose.pdf.Action afterSavingAction = actions.getAfterSaving();

退货: DocumentActionCollection - DocumentActionCollection 对象

getBackground()

public abstract Color getBackground()

获取文档的背景颜色。

退货: Color - java.awt.Color 对象

getCatalogValue(String key)

public abstract Object getCatalogValue(String key)

从目录字典返回项目值。

参数:

范围类型描述
keyjava.lang.String项目的关键。

退货: java.lang.Object - 项目值 - 如果成功找到键;否则为空。

getCollection()

public abstract Collection getCollection()

获取文档集合。

退货: Collection - 集合对象

getCryptoAlgorithm()

public abstract int getCryptoAlgorithm()

如果文档已加密,则获取安全设置。如果文档未加密,则在 .net 1.1 中将引发相应的异常,或者对于其他 .net 版本,CryptoAlgorithm 将为 null。

退货: int - 整数值

getDefaultCopier()

public abstract Copier getDefaultCopier()

将用于复印页面的复印机返回到此文档。

退货: Copier 复印机对象

getDestinations()

public abstract DestinationCollection getDestinations()

获取目的地的集合。

退货: DestinationCollection DestinationCollection 对象

getDirection()

public abstract int getDirection()

获取文本的阅读顺序:L2R(从左到右)或 R2L(从右到左)。

退货: int - 方向元素

getDuplex()

public abstract int getDuplex()

获取或设置从打印对话框打印文件时要使用的打印双面模式处理选项。

退货: int - PrintDuplex 元素

getEmbedStandardFonts()

public abstract boolean getEmbedStandardFonts()

声明文档必须嵌入所有标准 Type1 字体的属性,该字体的标志 IsEmbedded 设置为 true。所有 PDF 字体都可以简单地通过将标志 IsEmbedded 设置为 true 来嵌入到文档中,但 PDF 标准 Type1 字体是此规则的一个例外。标准 Type1 字体嵌入需要很多时间,因此要嵌入这些字体,不仅需要将指定字体的标志 IsEmbedded 设置为 true,还需要在文档级别设置一个附加标志 - EmbedStandardFonts = true;此属性只能为所有字体设置一次。默认为假。

退货: boolean - 布尔值

getEmbeddedFiles()

public abstract EmbeddedFileCollection getEmbeddedFiles()

获取嵌入文档的文件集合。

退货: EmbeddedFileCollection - EmbeddedFileCollection 对象

getEnableSignatureSanitization()

public abstract boolean getEnableSignatureSanitization()

获取或设置标志以管理签名字段清理。默认启用。

退货: boolean - 布尔值

getEngineDoc()

public abstract IPdfDocument getEngineDoc()

用于访问内部文档结构的 IPdfDocument 实例。仅限内部

退货: IPdfDocument IPdfDocument 对象

getFileName()

public abstract String getFileName()

生成此文档的 PDF 文件的名称

退货: java.lang.String - 字符串对象

getForm()

public abstract Form getForm()

获取文档的 Acro 形式。

退货: Form 表单对象

getId()

public abstract Id getId()

获取ID。

退货: Id Id 对象

getIgnoreCorruptedObjects()

public abstract boolean getIgnoreCorruptedObjects()

获取或设置忽略源文件中错误的标志。当源文档中的页面复制到目标文档中时,如果源文件中的某些对象已损坏,则复制过程将停止,但此标志为 false。例子: dest.Pages.Add(src.Pages);如果此标志设置为 true,则损坏的对象将被替换为空值。默认情况下:真。

退货: boolean - 布尔值

getInfo()

public abstract DocumentInfo getInfo()

获取文档信息。

退货: DocumentInfo - 文档信息对象

getLogicalStructure()

public abstract RootElement getLogicalStructure()

获取文档的逻辑结构。

退货: RootElement RootElement 对象

getMetadata()

public abstract Metadata getMetadata()

文档元数据。 (PDF 文档可能包含一般信息,例如文档的标题、作者以及创建和修改日期。此类关于文档的全局信息(相对于其内容或结构)称为元数据,旨在帮助编目和搜索对于外部数据库中的文档。)

退货: Metadata - 元数据对象

getMetadataStream()

public abstract IPdfStreamAccessor getMetadataStream()

返回原始元数据流

退货: IPdfStreamAccessor IPdfStreamAccessor 对象

getNamedDestinations()

public abstract NamedDestinationCollection getNamedDestinations()

文档中命名目标的集合。

退货: NamedDestinationCollection NamedDestinationCollection 实例

getNonFullScreenPageMode()

public abstract int getNonFullScreenPageMode()

获取页面模式,指定在退出全屏模式时如何显示文档。

退货: int - PageMode 元素

getObjectById(String id)

public abstract Object getObjectById(String id)

获取文档中具有指定 ID 的对象。

参数:

范围类型描述
idjava.lang.String对象标识。

退货: java.lang.Object - 具有指定 id 的对象。如果未找到 id,则为空。

getOpenAction()

public abstract IAppointment getOpenAction()

获取打开文档时执行的操作。


Example demonstrates how to get CenterWindow flag:
 Document document = new Document("sample.pdf");
 IAppointment value = document.getOpenAction();

退货: IAppointment-IAppointment 对象

getOptimizeSize()

public abstract boolean getOptimizeSize()

获取优化标志。将页面添加到文档时,如果设置了此标志,则结果文件中的相等资源流将合并到一个 PDF 对象中。这允许减少生成的文件大小,但可能会导致执行速度变慢和内存需求增加。默认值:假。

退货: boolean - 布尔值

getOutlines()

public abstract OutlineCollection getOutlines()

获取文档大纲。

退货: OutlineCollection - OutlineCollection 对象

getPageInfo()

public abstract PageInfo getPageInfo()

获取页面信息。(仅适用于生成器)

退货: PageInfo - 页面信息。

getPageLabels()

public abstract PageLabelCollection getPageLabels()

获取文档中的页面标签。

退货: PageLabelCollection - PageLabelCollection 对象

getPageLayout()

public abstract int getPageLayout()

获取打开文档时应使用的页面布局。

退货: int - PageLayout 元素

getPageMode()

public abstract int getPageMode()

获取页面模式,指定打开文档时应如何显示。

退货: int - PageMode 元素

getPages()

public abstract PageCollection getPages()

获取文档页面的集合。请注意,页面在集合中从 1 开始编号。


Example below demonstrates how to operate with the document pages:
 How to obtain number of pages and how to obtain rectangle of starting page of the document.

 Document document = new Document("sample.pdf");
 Pages pages = document.getPages();
 System.out.println("Document contains " + pages.size());
 Page page = pages.get_Item(1);
 Rectangle rect = page.getRect();

退货: PageCollection 布尔值

getPdfFormat()

public abstract PdfFormat getPdfFormat()

退货: PdfFormat - PdfFormat 元素

getPermissions()

public abstract int getPermissions()

获取文档的权限。

退货: int - 整数值

getVersion()

public abstract String getVersion()

从 Pdf 文件头获取 Pdf 的版本。

退货: java.lang.String - 字符串对象

getXmpMetadata(OutputStream stream)

public abstract void getXmpMetadata(OutputStream stream)

从文档中获取 XMP 元数据。

参数:

范围类型描述
streamjava.io.OutputStream将存储元数据的流。

importAnnotationsFromXfdf(String fileName)

public abstract void importAnnotationsFromXfdf(String fileName)

将注释从 XFDF 文件导入文档。

参数:

范围类型描述
fileNamejava.lang.StringXFDF 文件名

isAbsentFontTryToSubstitute()

public abstract boolean isAbsentFontTryToSubstitute()

处理文档时有关丢失字体的通知

退货: boolean - 布尔值

isCenterWindow()

public abstract boolean isCenterWindow()

获取指定文档窗口的位置是否将在屏幕上居中的标志。


Example demonstrates how to get CenterWindow flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isCenterWindow();

退货: boolean - 布尔值

isDisableFontLicenseVerifications()

public abstract boolean isDisableFontLicenseVerifications()

如果该字体的许可证禁止这些操作,则无法执行该字体的许多操作。例如,如果许可规则禁止嵌入某些字体,则无法将其嵌入到 PDF 文档中。此标志用于禁用当前 PDF 文档中所有字体的任何许可限制。使用此标志时要小心。当它被设置时,意味着设置这个标志的人,对自己可能违反许可/法律的行为承担全部责任。所以他自己承担风险。强烈建议仅当您完全确信自己没有违反版权法时才使用此标志。

退货: boolean - 布尔值默认为 false。

isDisplayDocTitle()

public abstract boolean isDisplayDocTitle()

获取指定文档窗口标题栏是否应显示文档标题的标志。


Example demonstrates how to get DisplayDocTitle flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isDisplayDocTitle();

退货: boolean - 布尔值

isEncrypted()

public abstract boolean isEncrypted()

获取文档的加密状态。如果文档已加密,则为真。

退货: boolean - 布尔值

isFitWindow()

public abstract boolean isFitWindow()

获取指定是否必须调整文档窗口大小以适合显示的第一个页面的标志。


Example demonstrates how to get FitWindow flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isFitWindow();

退货: boolean - 布尔值

isHideMenubar()

public abstract boolean isHideMenubar()

获取指定在文档处于活动状态时是否应隐藏菜单栏的标志。


Example demonstrates how to get HideMenubar flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isHideMenubar();

退货: boolean - 布尔值

isHideToolBar()

public abstract boolean isHideToolBar()

获取指定在文档处于活动状态时是否应隐藏工具栏的标志。


Example demonstrates how to get HideToolBar flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isHideToolBar();

退货: boolean - 布尔值

isHideWindowUI()

public abstract boolean isHideWindowUI()

获取或设置标志,该标志指定当文档处于活动状态时是否应隐藏用户界面元素。


Example demonstrates how to get HideWindowUI flag:

 Document document = new Document("sample.pdf");
 boolean value = document.isHideWindowUI();

退货: boolean - 布尔值

isLinearized()

public abstract boolean isLinearized()

获取或设置一个值,该值指示文档是否线性化。

退货: boolean - 布尔值

isManualDisposeEnabled()

public abstract boolean isManualDisposeEnabled()

默认方法保存关闭内部流并释放内存资源。如果启用此 ManualDispose 参数,我们可以在方法保存后执行一些操作并继续处理文档。

退货: boolean - 布尔值。 (默认值 == 假)

isPdfUaCompliant()

public abstract boolean isPdfUaCompliant()

获取符合 pdfua 标准的文档。

退货: boolean - 布尔值

isPdfaCompliant()

public abstract boolean isPdfaCompliant()

退货: 布尔值

isXrefGapsAllowed()

public abstract boolean isXrefGapsAllowed()

获取或设置文档 pdfa 兼容。

退货: boolean - 布尔值

optimize()

public abstract void optimize()

线性化文档以便 - 尽快打开第一页; - 尽快显示下一页或通过链接进入下一页; - 当页面数据通过慢速通道传送时,在页面到达时逐步显示页面(首先显示最有用的数据); - 允许甚至在接收和显示整个页面之前执行用户交互,例如跟随链接。调用此方法实际上并不保存文档。反之只准备有优化结构的文档,调用Save 即可得到优化后的文档。

optimizeResources()

public abstract void optimizeResources()

优化文档中的资源: 1. 去除文档页面中不用的资源; 2. 等量资源合并为一个对象; 3. 删除未使用的对象。

optimizeResources(OptimizationOptions strategy)

public abstract void optimizeResources(OptimizationOptions strategy)

根据定义的优化策略优化文档中的资源。

参数:

范围类型描述
strategyOptimizationOptions优化策略。

processParagraphs()

public abstract void processParagraphs()

将文档存储到流中。

removeMetadata()

public abstract void removeMetadata()

从文档中删除元数据。

removePdfUaCompliance()

public abstract void removePdfUaCompliance()

从文档中删除 pdfUa 合规性

removePdfaCompliance()

public abstract void removePdfaCompliance()

从文档中删除 pdfa 合规性

repair()

public abstract void repair()

修复损坏的文档。

resumeUpdate()

public abstract void resumeUpdate()

恢复更新

save()

public abstract void save()

增量保存文档(即使用增量更新技术)。


为了增量保存文档,我们应该打开文档文件进行写入。因此,Document 不能使用 InputStream 进行初始化,而必须使用文件路径进行初始化,如下一个代码片段所示:Document doc = new Document(“document.pdf”); // 进行一些更改并增量保存文档 doc.save();

如果文档是用 InputStream 初始化的,写入 InputStream 是不可能的,所以我们建议使用单独的方法“save”来保存文档或“saveIncrementally”来增量保存文档。

save(OutputStream output)

public abstract void save(OutputStream output)

将文档存储到流中。

参数:

范围类型描述
outputjava.io.OutputStream存储文档外壳的流。

save(OutputStream outputStream, SaveFormat format)

public abstract void save(OutputStream outputStream, SaveFormat format)

保存文件

参数:

范围类型描述
outputStreamjava.io.OutputStream输出流对象
formatSaveFormat保存格式值

save(OutputStream outputStream, SaveOptions options)

public abstract void save(OutputStream outputStream, SaveOptions options)

使用设置其保存选项的新名称保存文档。

参数:

范围类型描述
outputStreamjava.io.OutputStream将存储文档的 OutputStream。
optionsSaveOptions保存选项。

save(String outputFileName)

public abstract void save(String outputFileName)

将文档保存到指定的文件中。

参数:

范围类型描述
outputFileNamejava.lang.String将存储文档的文件路径。

save(String outputFileName, SaveOptions options)

public abstract void save(String outputFileName, SaveOptions options)

使用设置其保存选项的新名称保存文档。

参数:

范围类型描述
outputFileNamejava.lang.String将存储文档的文件路径。
optionsSaveOptions保存选项。

saveIncrementally(System.IO.Stream output)

public abstract void saveIncrementally(System.IO.Stream output)

将 PDF 文档增量保存到指定的流。

参数:

范围类型描述
outputcom.aspose.ms.System.IO.Stream输出流对象

saveIncrementally(OutputStream output)

public abstract void saveIncrementally(OutputStream output)

将 PDF 文档增量保存到指定的流。

参数:

范围类型描述
outputjava.io.OutputStream输出流对象

saveIncrementally(String outputFileName)

public abstract void saveIncrementally(String outputFileName)

将 PDF 文档增量保存到指定的流。

参数:

范围类型描述
outputFileNamejava.lang.String字符串值

saveXml(String file)

public abstract void saveXml(String file)

将文档保存为 XML。

参数:

范围类型描述
filejava.lang.String文档模型xml文件

sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)

public abstract void sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)

将文档的某些页面发送到文档设备进行处理。

参数:

范围类型描述
deviceDocumentDevice用于处理文档的文档设备。
fromPageint处理的第一页。
toPageint处理的最后一页。
outputjava.io.OutputStream输出流包含给定设备处理文档页面的结果。

sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)

public abstract void sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)

将整个文档发送到文档设备进行处理。

参数:

范围类型描述
deviceDocumentDevice用于处理文档的文档设备。
fromPageint处理的第一页。
toPageint处理的最后一页。
outputFileNamejava.lang.String带有处理结果的输出文件名。

sendTo(DocumentDevice device, OutputStream output)

public abstract void sendTo(DocumentDevice device, OutputStream output)

将整个文档发送到文档设备进行处理。

参数:

范围类型描述
deviceDocumentDevice文档设备对象
outputjava.io.OutputStream输出流对象

sendTo(DocumentDevice device, String outputFileName)

public abstract void sendTo(DocumentDevice device, String outputFileName)

将整个文档发送到文档设备进行处理。

参数:

范围类型描述
deviceDocumentDevice用于处理文档的文档设备。
outputFileNamejava.lang.String带有处理结果的输出文件名。

setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)

public abstract void setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)

在没有字体的情况下,设置程序确定字体的设置标志。

参数:

范围类型描述
setAbsentFontTryToSubstituteboolean布尔值

setBackground(Color value)

public abstract void setBackground(Color value)

设置文档的背景颜色。

参数:

范围类型描述
valuejava.awt.Colorjava.awt.Color 对象

setCenterWindow(boolean value)

public abstract void setCenterWindow(boolean value)

设置标志指定文档窗口的位置是否将在屏幕上居中。

参数:

范围类型描述
valueboolean布尔值

setCollection(Collection value)

public abstract void setCollection(Collection value)

设置文档集合。

参数:

范围类型描述
valueCollection集合对象

setConvertMetadataAndCatalogOnly(boolean value)

public abstract void setConvertMetadataAndCatalogOnly(boolean value)

获取 pdf/ua 转换器的转换参数(如果设置为 true,则仅转换元数据和文档目录)

参数:

范围类型描述
valueboolean布尔值

setDirection(int value)

public abstract void setDirection(int value)

设置文本的阅读顺序:L2R(从左到右)或 R2L(从右到左)。

参数:

范围类型描述
valueint方向元素

setDisableFontLicenseVerifications(boolean value)

public abstract void setDisableFontLicenseVerifications(boolean value)

如果该字体的许可证禁止这些操作,则无法执行该字体的许多操作。例如,如果许可规则禁止嵌入某些字体,则无法将其嵌入到 PDF 文档中。此标志用于禁用当前 PDF 文档中所有字体的任何许可限制。使用此标志时要小心。当它被设置时,意味着设置这个标志的人,对自己可能违反许可/法律的行为承担全部责任。所以他自己承担风险。强烈建议仅当您完全确信自己没有违反版权法时才使用此标志。

参数:

范围类型描述
valueboolean布尔值 默认为 false。

setDisplayDocTitle(boolean value)

public abstract void setDisplayDocTitle(boolean value)

设置标志指定文档的窗口标题栏是否应显示文档标题。

参数:

范围类型描述
valueboolean布尔值

setDuplex(int value)

public abstract void setDuplex(int value)

获取或设置从打印对话框打印文件时要使用的打印双面模式处理选项。

参数:

范围类型描述
valueintPrintDuplex 元素

setEmbedStandardFonts(boolean value)

public abstract void setEmbedStandardFonts(boolean value)

声明文档必须嵌入所有标准 Type1 字体的属性,该字体的标志 IsEmbedded 设置为 true。所有 PDF 字体都可以简单地通过将标志 IsEmbedded 设置为 true 来嵌入到文档中,但 PDF 标准 Type1 字体是此规则的一个例外。标准 Type1 字体嵌入需要很多时间,因此要嵌入这些字体,不仅需要将指定字体的标志 IsEmbedded 设置为 true,还需要在文档级别设置一个附加标志 - EmbedStandardFonts = true;此属性只能为所有字体设置一次。默认为假。

参数:

范围类型描述
valueboolean布尔值

setEnableSignatureSanitization(boolean value)

public abstract void setEnableSignatureSanitization(boolean value)

获取或设置标志以管理签名字段清理。默认启用。

参数:

范围类型描述
valueboolean布尔值

setFitWindow(boolean value)

public abstract void setFitWindow(boolean value)

设置标志,指定是否必须调整文档窗口的大小以适合显示的第一个页面。

参数:

范围类型描述
valueboolean布尔值

setHideMenubar(boolean value)

public abstract void setHideMenubar(boolean value)

设置标志,指定当文档处于活动状态时是否应隐藏菜单栏。

参数:

范围类型描述
valueboolean布尔值

setHideToolBar(boolean value)

public abstract void setHideToolBar(boolean value)

设置标志,指定在文档处于活动状态时工具栏是否应隐藏。

参数:

范围类型描述
valueboolean布尔值

setHideWindowUI(boolean value)

public abstract void setHideWindowUI(boolean value)

设置标志,指定在文档处于活动状态时是否应隐藏用户界面元素。

参数:

范围类型描述
valueboolean布尔值

setIgnoreCorruptedObjects(boolean value)

public abstract void setIgnoreCorruptedObjects(boolean value)

参数:

范围类型描述
valueboolean

setLayersAdded(boolean value)

public abstract void setLayersAdded(boolean value)

设置 LayersAdded 值

参数:

范围类型描述
valueboolean布尔值

setLinearized(boolean value)

public abstract void setLinearized(boolean value)

设置一个值,指示文档是否线性化。

参数:

范围类型描述
valueboolean布尔值

setManualDisposeEnabled(boolean manualDisposeEnabled)

public abstract void setManualDisposeEnabled(boolean manualDisposeEnabled)

默认方法 save 关闭内部流并释放内存资源。如果启用此 ManualDispose 参数,我们可以在调用方法保存后执行一些操作并继续处理文档。但强烈建议在不再需要 Document 实例时调用 dispose 方法。

参数:

范围类型描述
manualDisposeEnabledboolean布尔值。 (默认值 == 假)

setNonFullScreenPageMode(int value)

public abstract void setNonFullScreenPageMode(int value)

设置页面模式,指定在退出全屏模式时如何显示文档。

参数:

范围类型描述
valueintPageMode 元素

setOpenAction(IAppointment value)

public abstract void setOpenAction(IAppointment value)

设置在文档打开时执行的操作。

参数:

范围类型描述
valueIAppointment约会对象

setOptimizeSize(boolean value)

public abstract void setOptimizeSize(boolean value)

设置优化标志。将页面添加到文档时,如果设置了此标志,则结果文件中的相等资源流将合并到一个 PDF 对象中。这允许减少生成的文件大小,但可能会导致执行速度变慢和内存需求增加。默认值:假。

参数:

范围类型描述
valueboolean布尔值

setPageInfo(PageInfo value)

public abstract void setPageInfo(PageInfo value)

设置页面信息。(仅适用于生成器)

参数:

范围类型描述
valuePageInfoPageInfo 对象

setPageLayout(int value)

public abstract void setPageLayout(int value)

设置打开文档时应使用的页面布局。

参数:

范围类型描述
valueint页面布局元素

setPageMode(int value)

public abstract void setPageMode(int value)

设置页面模式,指定打开文档时应如何显示。

参数:

范围类型描述
valueintPageMode 元素

setTitle(String title)

public abstract void setTitle(String title)

为 Pdf 文档设置标题

参数:

范围类型描述
titlejava.lang.String文档的标题

setXmpMetadata(InputStream stream)

public abstract void setXmpMetadata(InputStream stream)

设置文档的 XMP 元数据。

参数:

范围类型描述
streamjava.io.InputStream包含 XMP 元数据的流。

setXrefGapsAllowed(boolean value)

public abstract void setXrefGapsAllowed(boolean value)

获取或设置文档 pdfa 兼容。

参数:

范围类型描述
valueboolean布尔值

suppressUpdate()

public abstract void suppressUpdate()

抑制更新

updatePages()

public abstract void updatePages()

更新页面

validate(OutputStream outputLogStream, PdfFormat format)

public abstract boolean validate(OutputStream outputLogStream, PdfFormat format)

将文档验证到指定的文件中。

参数:

范围类型描述
outputLogStreamjava.io.OutputStream将存储评论的流。
formatPdfFormatPDF 格式。

退货: boolean - 运算结果

validate(String outputLogFileName, PdfFormat format)

public abstract boolean validate(String outputLogFileName, PdfFormat format)

将文档验证到指定的文件中。

参数:

范围类型描述
outputLogFileNamejava.lang.String将存储评论的文件路径。
formatPdfFormatPDF 格式。

退货: boolean - 布尔值