diff --git a/chinese/rust-cpp/_index.md b/chinese/rust-cpp/_index.md new file mode 100644 index 00000000000..4612d939500 --- /dev/null +++ b/chinese/rust-cpp/_index.md @@ -0,0 +1,346 @@ +--- +title: "Aspose.PDF for Rust via C++" +description: "Aspose.PDF for Rust via C++" +keywords: "Rust, PDF, PDF toolkit, pdf, convert, processing" +tags: ['pdf-to-jpg', 'pdf-to-png', 'pdf-convert', 'pdf-tools'] +weight: 40 +url: /zh/rust-cpp/ +type: docs +is_root: true +--- + +> Aspose.PDF for Rust via C++ allows developers manipulate them PDF files directly in the Rust. + +# 结构体 + +## Document +Document 表示一个 PDF 文档。 + +```rust +pub struct Document { /* private fields */ } +``` + +# Implementations + +## Convert from PDF functions + +| 函数 | 描述 | +| -------- | ----------- | +| [save_docx](./convert/save_docx/) | 将先前打开的 PDF 文档转换并保存为 DocX 文档。 | +| [save_doc](./convert/save_doc/) | 将先前打开的 PDF 文档转换并保存为 Doc 文档。 | +| [save_xlsx](./convert/save_xlsx/) | 将先前打开的 PDF 文档转换并保存为 XlsX 文档。 | +| [save_txt](./convert/save_txt/) | 将先前打开的 PDF 文档转换并保存为 Txt 文档。 | +| [save_pptx](./convert/save_pptx/) | 将先前打开的 PDF 文档转换并保存为 PptX 文档。 | +| [save_xps](./convert/save_xps/) | 将先前打开的 PDF 文档转换并保存为 Xps 文档。 | +| [save_tex](./convert/save_tex/) | 将先前打开的 PDF 文档转换并保存为 TeX 文档。 | +| [save_epub](./convert/save_epub/) | 将先前打开的 PDF 文档转换并保存为 Epub 文档。 | +| [save_booklet](./convert/save_booklet/) | 将先前打开的 PDF 文档转换并保存为小册子 PDF 文档。 | +| [save_n_up](./convert/save_n_up/) | 将先前打开的 PDF 文档转换并保存为 N-Up PDF 文档。 | +| [save_markdown](./convert/save_markdown/) | 将先前打开的 PDF 文档转换并保存为 Markdown 文档。 | +| [save_tiff](./convert/save_tiff/) | 将先前打开的 PDF 文档转换并保存为 Tiff 文档。 | +| [save_docx_enhanced](./convert/save_docx_enhanced/) | 将先前打开的 PDF 文档转换并保存为 DocX 文档,使用增强识别模式(完全可编辑的表格和段落)。 | +| [save_svg_zip](./convert/save_svg_zip/) | 将先前打开的 PDF 文档转换并保存为 SVG 档案。 | +| [export_fdf](./convert/export_fdf/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 FDF 文档。 | +| [export_xfdf](./convert/export_xfdf/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 XFDF 文档。 | +| [export_xml](./convert/export_xml/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 XML 文档。 | +| [page_to_jpg](./convert/page_to_jpg/) | 将指定页面转换并保存为 Jpg 图像。 | +| [page_to_png](./convert/page_to_png/) | 将指定页面转换并保存为 Png 图像。 | +| [page_to_bmp](./convert/page_to_bmp/) | 将指定页面转换并保存为 Bmp 图像。 | +| [page_to_tiff](./convert/page_to_tiff/) | 将指定页面转换并保存为 Tiff-图像。 | +| [page_to_svg](./convert/page_to_svg/) | 将指定页面转换并保存为 Svg-图像。 | +| [page_to_pdf](./convert/page_to_pdf/) | 将指定页面转换并保存为 PDF-文档。 | +| [page_to_dicom](./convert/page_to_dicom/) | 将指定页面转换并保存为 DICOM-图像。 | + + +## Organize PDF functions + +| 函数 | 描述 | +| -------- | ----------- | +| [optimize](./organize/optimize/) | 优化 PDF-文档的内容。 | +| [optimize_resource](./organize/optimize_resource/) | 优化 PDF-文档的资源。 | +| [grayscale](./organize/grayscale/) | 将 PDF-文档 转换为黑白。 | +| [rotate](./organize/rotate/) | 旋转 PDF-文档。 | +| [set_background](./organize/set_background/) | 使用 RGB 值设置 PDF-文档 的背景颜色。 | +| [repair](./organize/repair/) | 修复 PDF-文档。 | +| [replace_text](./organize/replace_text/) | 替换 PDF-文档 中的文本 | +| [add_page_num](./organize/add_page_num/) | 向 PDF-文档 添加页码 | +| [add_text_header](./organize/add_text_header/) | 在 PDF-文档 的页眉中添加文本 | +| [add_text_footer](./organize/add_text_footer/) | 在 PDF-文档 的页脚中添加文本 | +| [flatten](./organize/flatten/) | 扁平化 PDF-文档 | +| [remove_annotations](./organize/remove_annotations/) | 删除 PDF-文档 中的批注 | +| [remove_attachments](./organize/remove_attachments/) | 删除 PDF-文档 中的附件 | +| [remove_blank_pages](./organize/remove_blank_pages/) | 删除 PDF-文档 中的空白页 | +| [remove_bookmarks](./organize/remove_bookmarks/) | 删除 PDF-文档 中的书签 | +| [remove_hidden_text](./organize/remove_hidden_text/) | 删除 PDF-文档 中的隐藏文本 | +| [remove_images](./organize/remove_images/) | 删除 PDF-文档 中的图像 | +| [remove_javascripts](./organize/remove_javascripts/) | 删除 PDF-文档 中的 Java 脚本 | +| [remove_tables](./organize/remove_tables/) | 删除 PDF-文档 中的表格。 | +| [remove_watermarks](./organize/remove_watermarks/) | 删除 PDF-文档 中的水印。 | +| [add_watermark](./organize/add_watermark/) | 向 PDF-文档 添加水印。 | +| [embed_fonts](./organize/embed_fonts/) | 在 PDF 文档中嵌入字体。 | +| [unembed_fonts](./organize/unembed_fonts/) | 在 PDF 文档中取消嵌入字体。 | +| [optimize_file_size](./organize/optimize_file_size/) | 通过图像压缩质量优化 PDF 文档的大小。 | +| [remove_text_headers](./organize/remove_text_headers/) | 从 PDF 文档中移除文本页眉。 | +| [remove_text_footers](./organize/remove_text_footers/) | 从 PDF 文档中移除文本页脚。 | +| [crop](./organize/crop/) | 裁剪 PDF 文档的页面。 | +| [replace_font](./organize/replace_font/) | 在 PDF 文档中替换字体。 | +| [convert](./organize/convert/) | 将 PDF 文档转换为具有指定 PDF 格式的 PDF 文档 | +| [validate](./organize/validate/) | 验证 PDF 文档是否符合 PDF 格式的规范 | +| [remove_pdfa_compliance](./organize/remove_pdfa_compliance/) | 从 PDF 文档中移除 PDF/A 合规性 | +| [remove_pdfua_compliance](./organize/remove_pdfua_compliance/) | 从 PDF 文档中移除 PDF/UA 合规性 | +| [is_pdfa_compliant](./organize/is_pdfa_compliant/) | 获取 PDF 文档是否符合 PDF/A 标准 | +| [is_pdfua_compliant](./organize/is_pdfua_compliant/) | 获取 PDF 文档是否符合 PDF/UA 标准 | +| [page_rotate](./organize/page_rotate/) | 旋转 PDF 文档中的页面。 | +| [page_set_size](./organize/page_set_size/) | 设置 PDF 文档中页面的大小。 | +| [page_grayscale](./organize/page_grayscale/) | 将页面转换为黑白。 | +| [page_add_text](./organize/page_add_text/) | 在页面上添加文本。 | +| [page_replace_text](./organize/page_replace_text/) | 在页面上替换文本 | +| [page_add_page_num](./organize/page_add_page_num/) | 在页面上添加页码 | +| [page_add_text_header](./organize/page_add_text_header/) | 在页面页眉中添加文本 | +| [page_add_text_footer](./organize/page_add_text_footer/) | 在页面页脚中添加文本 | +| [page_remove_annotations](./organize/page_remove_annotations/) | 移除页面中的批注。 | +| [page_remove_hidden_text](./organize/page_remove_hidden_text/) | 移除页面中的隐藏文本。 | +| [page_remove_images](./organize/page_remove_images/) | 移除页面中的图像。 | +| [page_remove_tables](./organize/page_remove_tables/) | 移除页面中的表格。 | +| [page_remove_watermarks](./organize/page_remove_watermarks/) | 删除页面中的水印。 | +| [page_add_watermark](./organize/page_add_watermark/) | 在页面上添加水印。 | +| [page_remove_text_headers](./organize/page_remove_text_headers/) | 删除页面中的文本页眉。 | +| [page_remove_text_footers](./organize/page_remove_text_footers/) | 删除页面中的文本页脚。 | +| [page_crop](./organize/page_crop/) | 裁剪页面。 | +| [page_replace_font](./organize/page_replace_font/) | 替换页面中的字体。 | +| [page_merge_layers](./organize/page_merge_layers/) | 将页面上的所有图层合并为单个图层,并使用指定的新图层名称。 | +| [page_layers](./organize/page_layers/) | 获取页面上图层的名称。 | + + +## Core PDF functions + +| 函数 | 描述 | +| -------- | ----------- | +| [new](./core/new/) | 创建一个新的 PDF 文档。 | +| [open](./core/open/) | 使用文件名打开 PDF 文档。 | +| [save](./core/save/) | 保存先前打开的 PDF 文档。 | +| [save_as](./core/save_as/) | 使用新文件名保存先前打开的 PDF 文档。 | +| [set_license](./core/set_license/) | 使用文件名设置许可证。 | +| [extract_text](./core/extract_text/) | 以纯文本返回 PDF 文档的内容。 | +| [word_count](./core/word_count/) | 返回 PDF 文档中的单词计数。 | +| [character_count](./core/character_count/) | 返回 PDF 文档中的字符计数。 | +| [append](./core/append/) | 追加来自另一个 PDF 文档的页面。 | +| [append_pages](./core/append_pages/) | 追加来自另一个 PDF 文档的选定页面。 | +| [merge_documents](./core/merge_documents/) | 通过合并提供的 PDF 文档创建一个新的 PDF 文档。 | +| [split_document](./core/split_document/) | 通过从源 PDF 文档中提取页面创建多个新的 PDF 文档。 | +| [split](./core/split/) | 通过从当前 PDF 文档中提取页面创建多个新的 PDF 文档。 | +| [split_at_page](./core/split_at_page/) | 将 PDF 文档拆分为两个新的 PDF 文档。 | +| [split_at](./core/split_at/) | 将当前 PDF 文档拆分为两个新的 PDF 文档。 | +| [bytes](./core/bytes/) | 以字节向量返回 PDF 文档的内容。 | +| [get_meta_info](./core/get_meta_info/) | 获取 PDF 文档的元信息值。 | +| [set_meta_info](./core/set_meta_info/) | 设置 PDF-document 的元信息值。 | +| [clear_meta_info](./core/clear_meta_info/) | 清除 PDF-document 的所有元信息值。 | +| [is_linearized](./core/is_linearized/) | 获取指示文档是否已线性化的值。 | +| [page_add](./core/page_add/) | 在 PDF-document 中添加新页面。 | +| [page_insert](./core/page_insert/) | 在 PDF-document 中的指定位置插入新页面。 | +| [page_delete](./core/page_delete/) | 删除 PDF-document 中指定的页面。 | +| [page_count](./core/page_count/) | 返回 PDF-document 的页数。 | +| [page_word_count](./core/page_word_count/) | 返回 PDF-document 中指定页面的单词计数。 | +| [page_character_count](./core/page_character_count/) | 返回 PDF-document 中指定页面的字符计数。 | +| [page_is_blank](./core/page_is_blank/) | 返回 PDF-document 中页面是否为空白。 | + + +## Security +| 函数 | 描述 | +| -------- | ----------- | +| [open_with_password](./security/open_with_password/) | 打开受密码保护的 PDF-document。 | +| [encrypt](./security/encrypt/) | 加密 PDF-document。 | +| [decrypt](./security/decrypt/) | 解密 PDF-document。 | +| [set_permissions](./security/set_permissions/) | 设置 PDF-document 的权限。 | +| [get_permissions](./security/get_permissions/) | 获取 PDF-document 的当前权限。 | +| [is_encrypted](./security/is_encrypted/) | 获取 PDF-document 的加密状态。 | +| [sign_pkcs7](./security/sign_pkcs7/) | 使用 PKCS#7 数字签名对 PDF-document 进行签名。 | +| [sign_pkcs7_detached](./security/sign_pkcs7_detached/) | 使用 PKCS#7 分离式数字签名对 PDF-document 进行签名。 | +| [is_signed](./security/is_signed/) | 获取 PDF-document 的签名状态。 | +| [remove_signs](./security/remove_signs/) | 从 PDF-document 中移除签名。 | + + +## Miscellaneous + +| 函数 | 描述 | +| -------- | ----------- | +| [about](./miscellaneous/about/) | 返回关于通过 C++ 使用的 Aspose.PDF for Rust 的元数据信息。 | + + + +# Structs secondary + +## ProductInfo contains metadata about the Aspose.PDF for Rust via C++. +```rust +#[derive(Debug, Deserialize)] +pub struct ProductInfo { + #[serde(rename = "product")] + pub product: String, + + #[serde(rename = "family")] + pub family: String, + + #[serde(rename = "version")] + pub version: String, + + #[serde(rename = "releasedate")] + pub release_date: String, + + #[serde(rename = "producer")] + pub producer: String, + + #[serde(rename = "islicensed")] + pub is_licensed: bool, +} +``` + +## Bitflag set representing PDF permission capabilities. +```rust +bitflags! { + /// 表示 PDF 权限功能的位标志集合。 + #[derive(Copy, Clone, PartialEq, Eq)] + pub struct Permissions: i32 { + const PRINT_DOCUMENT = 1 << 2; // 4 + const MODIFY_CONTENT = 1 << 3; // 8 + const EXTRACT_CONTENT = 1 << 4; // 16 + const MODIFY_TEXT_ANNOTATIONS = 1 << 5; // 32 + const FILL_FORM = 1 << 8; // 256 + const EXTRACT_CONTENT_WITH_DISABILITIES = 1 << 9; // 512 + const ASSEMBLE_DOCUMENT = 1 << 10; // 1024 + const PRINTING_QUALITY = 1 << 11; // 2048 + } +} +``` + +# Enums + +## Enumeration of possible page size values. +```rust +pub enum PageSize { + /// A0 尺寸。 + A0 = 0, + /// A1 尺寸。 + A1 = 1, + /// A2 尺寸。 + A2 = 2, + /// A3 尺寸。 + A3 = 3, + /// A4 尺寸。 + A4 = 4, + /// A5 尺寸。 + A5 = 5, + /// A6 尺寸。 + A6 = 6, + /// B5 尺寸。 + B5 = 7, + /// PageLetter 尺寸。 + PageLetter = 8, + /// PageLegal 尺寸。 + PageLegal = 9, + /// PageLedger 尺寸。 + PageLedger = 10, + /// P11x17 尺寸。 + P11x17 = 11, +} +``` + +## Enumeration of possible rotation values. +```rust +pub enum Rotation { + /// 未旋转。 + None = 0, + /// 顺时针旋转 90 度。 + On90 = 1, + /// 旋转 180 度。 + On180 = 2, + /// 顺时针旋转 270 度。 + On270 = 3, + /// 顺时针旋转 360 度。 + On360 = 4, +} +``` + +## An enumeration of possible crypto algorithms. +```rust +pub enum CryptoAlgorithm { + /// RC4,密钥长度为 40。 + RC4x40 = 0, + /// RC4,密钥长度为 128。 + RC4x128 = 1, + /// AES,密钥长度为 128。 + AESx128 = 2, + /// AES,密钥长度为 256。 + AESx256 = 3, +} +``` + +## An enumeration of possible PDF format standards. +```rust +pub enum PdfFormat { + /// PDF/A-1a 格式。 + PDF_A_1A = 0, + /// PDF/A-1b 格式。 + PDF_A_1B = 1, + /// PDF/A-2a 格式。 + PDF_A_2A = 2, + /// PDF/A-3a 格式。 + PDF_A_3A = 3, + /// PDF/A-2b 格式。 + PDF_A_2B = 4, + /// PDF/A-2u 格式。 + PDF_A_2U = 5, + /// PDF/A-3b 格式。 + PDF_A_3B = 6, + /// PDF/A-3u 格式. + PDF_A_3U = 7, + /// Adobe 版本 1.0. + V_1_0 = 8, + /// Adobe 版本 1.1. + V_1_1 = 9, + /// Adobe 版本 1.2. + V_1_2 = 10, + /// Adobe 版本 1.3. + V_1_3 = 11, + /// Adobe 版本 1.4. + V_1_4 = 12, + /// Adobe 版本 1.5. + V_1_5 = 13, + /// Adobe 版本 1.6. + V_1_6 = 14, + /// Adobe 版本 1.7. + V_1_7 = 15, + /// ISO 标准 PDF 2.0. + V_2_0 = 16, + /// PDF/UA-1 格式. + PDF_UA_1 = 17, + /// PDF/X-1a:2001 格式. + PDF_X_1A_2001 = 18, + /// PDF/X-1a 格式. + PDF_X_1A = 19, + /// PDF/X-3 格式. + PDF_X_3 = 20, + /// ZUGFeRD 格式. + ZUGFeRD = 21, + /// PDF/A-4 格式. + PDF_A_4 = 22, + /// PDF/A-4e 格式. + PDF_A_4E = 23, + /// PDF/A-4f 格式. + PDF_A_4F = 24, + /// PDF/X-4 格式. + PDF_X_4 = 25, + /// PDF/E-1 (PDF 1.6) 格式. + PDF_E_1 = 26, +} +``` + +## An enumeration of actions to take when a conversion error occurs. +```rust +pub enum ConvertErrorAction { + /// 删除不符合规范的元素. + Delete = 0, + /// 不执行任何操作,保留不符合规范的元素. + None = 1, +} +``` + diff --git a/chinese/rust-cpp/convert/_index.md b/chinese/rust-cpp/convert/_index.md new file mode 100644 index 00000000000..2a037579c62 --- /dev/null +++ b/chinese/rust-cpp/convert/_index.md @@ -0,0 +1,42 @@ +--- +title: "从 PDF 函数转换" +second_title: "Aspose.PDF for Rust via C++" +description: "用于从 PDF 文件转换的函数." +type: docs +url: /zh/rust-cpp/convert/ +--- + +## Convert from PDF functions + +| 名称 | 描述 | +| -------------- | -------------- | +| [save_docx](./save_docx/) | 将先前打开的 PDF 文档转换并保存为 DocX 文档。 | +| [save_doc](./save_doc/) | 将先前打开的 PDF 文档转换并保存为 Doc 文档。 | +| [save_xlsx](./save_xlsx/) | 将先前打开的 PDF 文档转换并保存为 XlsX 文档。 | +| [save_txt](./save_txt/) | 将先前打开的 PDF 文档转换并保存为 Txt 文档。 | +| [save_pptx](./save_pptx/) | 将先前打开的 PDF 文档转换并保存为 PptX 文档。 | +| [save_xps](./save_xps/) | 将先前打开的 PDF 文档转换并保存为 Xps 文档。 | +| [save_tex](./save_tex/) | 将先前打开的 PDF 文档转换并保存为 TeX 文档。 | +| [save_epub](./save_epub/) | 将先前打开的 PDF 文档转换并保存为 Epub 文档。 | +| [save_booklet](./save_booklet/) | 将先前打开的 PDF 文档转换并保存为小册子 PDF 文档。 | +| [save_n_up](./save_n_up/) | 将先前打开的 PDF 文档转换并保存为 N-Up PDF 文档。 | +| [save_markdown](./save_markdown/) | 将先前打开的 PDF 文档转换并保存为 Markdown 文档。 | +| [save_tiff](./save_tiff/) | 将先前打开的 PDF 文档转换并保存为 Tiff 文档。 | +| [save_docx_enhanced](./save_docx_enhanced/) | 将先前打开的 PDF 文档转换并保存为 DocX 文档,使用增强识别模式(完全可编辑的表格和段落)。 | +| [save_svg_zip](./save_svg_zip/) | 将先前打开的 PDF 文档转换并保存为 SVG 档案。 | +| [export_fdf](./export_fdf/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 FDF 文档。 | +| [export_xfdf](./export_xfdf/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 XFDF 文档。 | +| [export_xml](./export_xml/) | 从先前打开的带有 AcroForm 的 PDF 文档导出为 XML 文档。 | +| [page_to_jpg](./page_to_jpg/) | 将指定页面转换并保存为 Jpg 图像。 | +| [page_to_png](./page_to_png/) | 将指定页面转换并保存为 Png 图像。 | +| [page_to_bmp](./page_to_bmp/) | 将指定页面转换并保存为 Bmp 图像。 | +| [page_to_tiff](./page_to_tiff/) | 将指定页面转换并保存为 Tiff-图像。 | +| [page_to_svg](./page_to_svg/) | 将指定页面转换并保存为 Svg-图像。 | +| [page_to_pdf](./page_to_pdf/) | 将指定页面转换并保存为 PDF-文档。 | +| [page_to_dicom](./page_to_dicom/) | 将指定页面转换并保存为 DICOM-图像。 | + + +## Detailed Description + +用于从 PDF 文件转换的函数. + diff --git a/chinese/rust-cpp/convert/export_fdf/_index.md b/chinese/rust-cpp/convert/export_fdf/_index.md new file mode 100644 index 00000000000..68cb88e2c55 --- /dev/null +++ b/chinese/rust-cpp/convert/export_fdf/_index.md @@ -0,0 +1,37 @@ +--- +title: "export_fdf" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的带有 AcroForm 的 PDF 文档导出为具有文件名的 FDF 文档。" +type: docs +url: /zh/rust-cpp/convert/export_fdf/ +--- + +_将先前打开的带有 AcroForm 的 PDF 文档导出为具有文件名的 FDF 文档。_ + +```rust +pub fn export_fdf(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的带有 AcroForm 的 PDF 文档导出为 FDF 文档 + pdf.export_fdf("sample.fdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/export_xfdf/_index.md b/chinese/rust-cpp/convert/export_xfdf/_index.md new file mode 100644 index 00000000000..268853f2046 --- /dev/null +++ b/chinese/rust-cpp/convert/export_xfdf/_index.md @@ -0,0 +1,37 @@ +--- +title: "export_xfdf" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的带有 AcroForm 的 PDF-document 导出为带文件名的 XFDF-document。" +type: docs +url: /zh/rust-cpp/convert/export_xfdf/ +--- + +_将先前打开的带有 AcroForm 的 PDF-document 导出为带文件名的 XFDF-document。_ + +```rust +pub fn export_xfdf(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从先前打开的带有 AcroForm 的 PDF-document 导出为 XFDF-document + pdf.export_xfdf("sample.xfdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/export_xml/_index.md b/chinese/rust-cpp/convert/export_xml/_index.md new file mode 100644 index 00000000000..6ecd0edc136 --- /dev/null +++ b/chinese/rust-cpp/convert/export_xml/_index.md @@ -0,0 +1,37 @@ +--- +title: "export_xml" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的带有 AcroForm 的 PDF-document 导出为带文件名的 XML-document。" +type: docs +url: /zh/rust-cpp/convert/export_xml/ +--- + +_将先前打开的带有 AcroForm 的 PDF-document 导出为带文件名的 XML-document。_ + +```rust +pub fn export_xml(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从先前打开的带有 AcroForm 的 PDF-document 导出为 XML-document + pdf.export_xml("sample.xml")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_bmp/_index.md b/chinese/rust-cpp/convert/page_to_bmp/_index.md new file mode 100644 index 00000000000..b2a6d892420 --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_bmp/_index.md @@ -0,0 +1,39 @@ +--- +title: "page_to_bmp" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 BMP-image。" +type: docs +url: /zh/rust-cpp/convert/page_to_bmp/ +--- + +_将指定页面转换并保存为 BMP-image._ + +```rust +pub fn page_to_bmp(&self, num: i32, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存指定页面为 Bmp-image + pdf.page_to_bmp(1, 100, "sample_page1.bmp")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_dicom/_index.md b/chinese/rust-cpp/convert/page_to_dicom/_index.md new file mode 100644 index 00000000000..51c14b25272 --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_dicom/_index.md @@ -0,0 +1,39 @@ +--- +title: "page_to_dicom" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 DICOM-image。" +type: docs +url: /zh/rust-cpp/convert/page_to_dicom/ +--- + +_将指定页面转换并保存为 DICOM-image。_ + +```rust +pub fn page_to_dicom(&self, num: i32, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存指定页面为 DICOM-image + pdf.page_to_dicom(1, 100, "sample_page1.dcm")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_jpg/_index.md b/chinese/rust-cpp/convert/page_to_jpg/_index.md new file mode 100644 index 00000000000..f052ef7374b --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_jpg/_index.md @@ -0,0 +1,39 @@ +--- +title: "page_to_jpg" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 JPG-image。" +type: docs +url: /zh/rust-cpp/convert/page_to_jpg/ +--- + +_将指定页面转换并保存为 JPG-image._ + +```rust +pub fn page_to_jpg(&self, num: i32, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将指定页面转换并保存为 Jpg-image + pdf.page_to_jpg(1, 100, "sample_page1.jpg")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_pdf/_index.md b/chinese/rust-cpp/convert/page_to_pdf/_index.md new file mode 100644 index 00000000000..fbb33c55299 --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_pdf/_index.md @@ -0,0 +1,38 @@ +--- +title: "page_to_pdf" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 PDF-document。" +type: docs +url: /zh/rust-cpp/convert/page_to_pdf/ +--- + +_将指定页面转换并保存为 PDF-document。_ + +```rust +pub fn page_to_pdf(&self, num: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存指定页面为 PDF-document + pdf.page_to_pdf(1, "sample_page1.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_png/_index.md b/chinese/rust-cpp/convert/page_to_png/_index.md new file mode 100644 index 00000000000..f410851cf8c --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_png/_index.md @@ -0,0 +1,39 @@ +--- +title: "page_to_png" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 PNG 图像。" +type: docs +url: /zh/rust-cpp/convert/page_to_png/ +--- + +_将指定页面转换并保存为 PNG 图像。_ + +```rust +pub fn page_to_png(&self, num: i32, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将指定页面转换并保存为 Png 图像 + pdf.page_to_png(1, 100, "sample_page1.png")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_svg/_index.md b/chinese/rust-cpp/convert/page_to_svg/_index.md new file mode 100644 index 00000000000..07dca04eef0 --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_svg/_index.md @@ -0,0 +1,38 @@ +--- +title: "page_to_svg" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 SVG-image。" +type: docs +url: /zh/rust-cpp/convert/page_to_svg/ +--- + +_将指定页面转换并保存为 SVG-image._ + +```rust +pub fn page_to_svg(&self, num: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存指定页面为 Svg-image + pdf.page_to_svg(1, "sample_page1.svg")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/page_to_tiff/_index.md b/chinese/rust-cpp/convert/page_to_tiff/_index.md new file mode 100644 index 00000000000..bcdb3c128ae --- /dev/null +++ b/chinese/rust-cpp/convert/page_to_tiff/_index.md @@ -0,0 +1,39 @@ +--- +title: "page_to_tiff" +second_title: "Aspose.PDF for Rust via C++" +description: "将指定页面转换并保存为 TIFF 图像。" +type: docs +url: /zh/rust-cpp/convert/page_to_tiff/ +--- + +_将指定页面转换并保存为 TIFF 图像。_ + +```rust +pub fn page_to_tiff(&self, num: i32, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将指定页面转换并保存为 Tiff 图像 + pdf.page_to_tiff(1, 100, "sample_page1.tiff")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_booklet/_index.md b/chinese/rust-cpp/convert/save_booklet/_index.md new file mode 100644 index 00000000000..ec31baeefe5 --- /dev/null +++ b/chinese/rust-cpp/convert/save_booklet/_index.md @@ -0,0 +1,36 @@ +--- +title: "save_booklet" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为小册子 PDF-document。" +type: docs +url: /zh/rust-cpp/convert/save_booklet/ +--- + +_将先前打开的 PDF-document 转换并保存为小册子 PDF-document._ + +```rust +pub fn save_booklet(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为小册子 PDF-document + pdf.save_booklet("sample_booklet.pdf")?; + + Ok(()) +} +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_doc/_index.md b/chinese/rust-cpp/convert/save_doc/_index.md new file mode 100644 index 00000000000..8c08e8e2a68 --- /dev/null +++ b/chinese/rust-cpp/convert/save_doc/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_doc" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 DOC-document。" +type: docs +url: /zh/rust-cpp/convert/save_doc/ +--- + +_将先前打开的 PDF-document 转换并保存为 DOC-document._ + +```rust +pub fn save_doc(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 Doc-document + pdf.save_doc("sample.doc")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_docx/_index.md b/chinese/rust-cpp/convert/save_docx/_index.md new file mode 100644 index 00000000000..d95f6bf293d --- /dev/null +++ b/chinese/rust-cpp/convert/save_docx/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_docx" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 DOCX-document。" +type: docs +url: /zh/rust-cpp/convert/save_docx/ +--- + +_将先前打开的 PDF-document 转换并保存为 DOCX-document._ + +```rust +pub fn save_docx(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 DocX-document + pdf.save_docx("sample.docx")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_docx_enhanced/_index.md b/chinese/rust-cpp/convert/save_docx_enhanced/_index.md new file mode 100644 index 00000000000..5cd7236d6fc --- /dev/null +++ b/chinese/rust-cpp/convert/save_docx_enhanced/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_docx_enhanced" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 DOCX-document,使用增强识别模式(完全可编辑的表格和段落)。" +type: docs +url: /zh/rust-cpp/convert/save_docx_enhanced/ +--- + +_将先前打开的 PDF-document 转换并保存为 DOCX-document,使用增强识别模式(完全可编辑的表格和段落)。_ + +```rust +pub fn save_docx_enhanced(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 DocX-document,使用增强识别模式(完全可编辑的表格和段落) + pdf.save_docx_enhanced("sample_enhanced.docx")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_epub/_index.md b/chinese/rust-cpp/convert/save_epub/_index.md new file mode 100644 index 00000000000..276a3520f9a --- /dev/null +++ b/chinese/rust-cpp/convert/save_epub/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_epub" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 EPUB-document。" +type: docs +url: /zh/rust-cpp/convert/save_epub/ +--- + +_将先前打开的 PDF-document 转换并保存为 EPUB-document._ + +```rust +pub fn save_epub(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 Epub-document + pdf.save_epub("sample.epub")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_markdown/_index.md b/chinese/rust-cpp/convert/save_markdown/_index.md new file mode 100644 index 00000000000..694bbef7e31 --- /dev/null +++ b/chinese/rust-cpp/convert/save_markdown/_index.md @@ -0,0 +1,36 @@ +--- +title: "save_markdown" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF 文档转换并保存为 Markdown 文档。" +type: docs +url: /zh/rust-cpp/convert/save_markdown/ +--- + +_将先前打开的 PDF 文档转换并保存为 Markdown 文档。_ + +```rust +pub fn save_markdown(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF 文档转换并保存为 Markdown 文档 + pdf.save_markdown("sample.md")?; + + Ok(()) +} +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_n_up/_index.md b/chinese/rust-cpp/convert/save_n_up/_index.md new file mode 100644 index 00000000000..3dd0ca63568 --- /dev/null +++ b/chinese/rust-cpp/convert/save_n_up/_index.md @@ -0,0 +1,38 @@ +--- +title: "save_n_up" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 N-Up PDF-document。" +type: docs +url: /zh/rust-cpp/convert/save_n_up/ +--- + +_将先前打开的 PDF-document 转换并保存为 N-Up PDF-document._ + +```rust +pub fn save_n_up(&self, filename: &str, columns: i32, rows: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + * **columns** - the number of columns + * **rows** - the number of rows + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 N-Up PDF-document + pdf.save_n_up("sample_n_up.pdf", 2, 2)?; + + Ok(()) +} +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_pptx/_index.md b/chinese/rust-cpp/convert/save_pptx/_index.md new file mode 100644 index 00000000000..90f55d1a41e --- /dev/null +++ b/chinese/rust-cpp/convert/save_pptx/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_pptx" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 PPTX-document。" +type: docs +url: /zh/rust-cpp/convert/save_pptx/ +--- + +_将先前打开的 PDF-document 转换并保存为 PPTX-document._ + +```rust +pub fn save_pptx(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 PptX-document + pdf.save_pptx("sample.pptx")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_svg_zip/_index.md b/chinese/rust-cpp/convert/save_svg_zip/_index.md new file mode 100644 index 00000000000..47e276ab893 --- /dev/null +++ b/chinese/rust-cpp/convert/save_svg_zip/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_svg_zip" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 SVG-archive。" +type: docs +url: /zh/rust-cpp/convert/save_svg_zip/ +--- + +_将先前打开的 PDF-document 转换并保存为 SVG-archive。_ + +```rust +pub fn save_svg_zip(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 SVG-archive + pdf.save_svg_zip("sample_svg.zip")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_tex/_index.md b/chinese/rust-cpp/convert/save_tex/_index.md new file mode 100644 index 00000000000..f716de72f86 --- /dev/null +++ b/chinese/rust-cpp/convert/save_tex/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_tex" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 TeX-document。" +type: docs +url: /zh/rust-cpp/convert/save_tex/ +--- + +_将先前打开的 PDF-document 转换并保存为 TeX-document._ + +```rust +pub fn save_tex(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 TeX-document + pdf.save_tex("sample.tex")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_tiff/_index.md b/chinese/rust-cpp/convert/save_tiff/_index.md new file mode 100644 index 00000000000..106e24e9c82 --- /dev/null +++ b/chinese/rust-cpp/convert/save_tiff/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_tiff" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 Tiff-document。" +type: docs +url: /zh/rust-cpp/convert/save_tiff/ +--- + +_将先前打开的 PDF-document 转换并保存为 Tiff-document._ + +```rust +pub fn save_tiff(&self, resolution_dpi: i32, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **resolution_dpi** - the resolution in DPI + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 Tiff-document + pdf.save_tiff(100, "sample.tiff")?; + + Ok(()) +} +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_txt/_index.md b/chinese/rust-cpp/convert/save_txt/_index.md new file mode 100644 index 00000000000..31c41864dd3 --- /dev/null +++ b/chinese/rust-cpp/convert/save_txt/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_txt" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 TXT-document。" +type: docs +url: /zh/rust-cpp/convert/save_txt/ +--- + +_将先前打开的 PDF-document 转换并保存为 TXT-document。_ + +```rust +pub fn save_txt(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 Txt-document + pdf.save_txt("sample.txt")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_xlsx/_index.md b/chinese/rust-cpp/convert/save_xlsx/_index.md new file mode 100644 index 00000000000..45bdf2cb2c7 --- /dev/null +++ b/chinese/rust-cpp/convert/save_xlsx/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_xlsx" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 XLSX-document." +type: docs +url: /zh/rust-cpp/convert/save_xlsx/ +--- + +_将先前打开的 PDF-document 转换并保存为 XLSX-document._ + +```rust +pub fn save_xlsx(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将先前打开的 PDF-document 转换并保存为 XlsX-document + pdf.save_xlsx("sample.xlsx")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/convert/save_xps/_index.md b/chinese/rust-cpp/convert/save_xps/_index.md new file mode 100644 index 00000000000..a6b499bf9d5 --- /dev/null +++ b/chinese/rust-cpp/convert/save_xps/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_xps" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 转换并保存为 XPS-document。" +type: docs +url: /zh/rust-cpp/convert/save_xps/ +--- + +_将先前打开的 PDF-document 转换并保存为 XPS-document._ + +```rust +pub fn save_xps(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 转换并保存先前打开的 PDF-document 为 Xps-document + pdf.save_xps("sample.xps")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/_index.md b/chinese/rust-cpp/core/_index.md new file mode 100644 index 00000000000..bd601e0e8ee --- /dev/null +++ b/chinese/rust-cpp/core/_index.md @@ -0,0 +1,45 @@ +--- +title: "核心 PDF 功能" +second_title: "Aspose.PDF for Rust via C++" +description: "用于处理 PDF 文件的核心功能。" +type: docs +url: /zh/rust-cpp/core/ +--- + +## Core PDF functions + +| 名称 | 描述 | +| -------------- | -------------- | +| [new](./new/) | 创建一个新的 PDF 文档。 | +| [open](./open/) | 使用文件名打开 PDF 文档。 | +| [save](./save/) | 保存先前打开的 PDF 文档。 | +| [save_as](./save_as/) | 使用新文件名保存先前打开的 PDF 文档。 | +| [set_license](./set_license/) | 使用文件名设置许可证。 | +| [extract_text](./extract_text/) | 以纯文本返回 PDF 文档的内容。 | +| [word_count](./word_count/) | 返回 PDF 文档中的单词计数。 | +| [character_count](./character_count/) | 返回 PDF 文档中的字符计数。 | +| [append](./append/) | 追加来自另一个 PDF 文档的页面。 | +| [append_pages](./append_pages/) | 追加来自另一个 PDF 文档的选定页面。 | +| [merge_documents](./merge_documents/) | 通过合并提供的 PDF 文档创建一个新的 PDF 文档。 | +| [split_document](./split_document/) | 通过从源 PDF 文档中提取页面创建多个新的 PDF 文档。 | +| [split](./split/) | 通过从当前 PDF 文档中提取页面创建多个新的 PDF 文档。 | +| [split_at_page](./split_at_page/) | 将 PDF 文档拆分为两个新的 PDF 文档。 | +| [split_at](./split_at/) | 将当前 PDF 文档拆分为两个新的 PDF 文档。 | +| [bytes](./bytes/) | 以字节向量返回 PDF 文档的内容。 | +| [get_meta_info](./get_meta_info/) | 获取 PDF 文档的元信息值。 | +| [set_meta_info](./set_meta_info/) | 设置 PDF-document 的元信息值。 | +| [clear_meta_info](./clear_meta_info/) | 清除 PDF-document 的所有元信息值。 | +| [is_linearized](./is_linearized/) | 获取指示文档是否已线性化的值。 | +| [page_add](./page_add/) | 在 PDF-document 中添加新页面。 | +| [page_insert](./page_insert/) | 在 PDF-document 中的指定位置插入新页面。 | +| [page_delete](./page_delete/) | 删除 PDF-document 中指定的页面。 | +| [page_count](./page_count/) | 返回 PDF-document 的页数。 | +| [page_word_count](./page_word_count/) | 返回 PDF-document 中指定页面的单词计数。 | +| [page_character_count](./page_character_count/) | 返回 PDF-document 中指定页面的字符计数。 | +| [page_is_blank](./page_is_blank/) | 返回 PDF-document 中页面是否为空白。 | + + +## Detailed Description + +用于处理 PDF 文件的核心功能。 + diff --git a/chinese/rust-cpp/core/append/_index.md b/chinese/rust-cpp/core/append/_index.md new file mode 100644 index 00000000000..adf6e51296c --- /dev/null +++ b/chinese/rust-cpp/core/append/_index.md @@ -0,0 +1,43 @@ +--- +title: "append" +second_title: "Aspose.PDF for Rust via C++" +description: "追加来自另一个 PDF-document 的页面." +type: docs +url: /zh/rust-cpp/core/append/ +--- + +_追加来自另一个 PDF-document 的页面._ + +```rust +pub fn append(&self, other: &Document) -> Result<(), PdfError> +``` + +**Arguments** + * **other** - a reference to another PDF-document to append pages from + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开主要的 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 打开另一个 PDF 文档以追加 + let another_pdf = Document::open("sample1page.pdf")?; + + // 追加来自另一个 PDF 文档的页面 + pdf.append(&another_pdf)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_append.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/append_pages/_index.md b/chinese/rust-cpp/core/append_pages/_index.md new file mode 100644 index 00000000000..79e17e1d62a --- /dev/null +++ b/chinese/rust-cpp/core/append_pages/_index.md @@ -0,0 +1,44 @@ +--- +title: "append_pages" +second_title: "Aspose.PDF for Rust via C++" +description: "从另一个 PDF 文档追加选定的页面。" +type: docs +url: /zh/rust-cpp/core/append_pages/ +--- + +_从另一个 PDF 文档追加选定的页面。_ + +```rust +pub fn append_pages(&self, other: &Document, page_range: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **other** - a reference to another PDF-document to append pages from + * **page_range** - a string defining the page ranges to append (e.g. "-2,4,6-8,10-") + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开主要的 PDF-document + let pdf = Document::open("sample1page.pdf")?; + + // 打开另一个 PDF 文档以追加 + let another_pdf = Document::open("sample.pdf")?; + + // 从另一个 PDF 文档追加特定页面(1 和 3) + pdf.append_pages(&another_pdf, "1,3")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_append_pages.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/bytes/_index.md b/chinese/rust-cpp/core/bytes/_index.md new file mode 100644 index 00000000000..160aaea299e --- /dev/null +++ b/chinese/rust-cpp/core/bytes/_index.md @@ -0,0 +1,40 @@ +--- +title: "bytes" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 的内容,形式为字节向量。" +type: docs +url: /zh/rust-cpp/core/bytes/ +--- + +_返回 PDF-document 的内容,形式为字节向量。_ + +```rust +pub fn bytes(&self) -> Result, PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(Vec\)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 返回 PDF-document 的内容,形式为字节向量 + let data = pdf.bytes()?; + + // 打印字节向量的长度 + println!("Length: {}", data.len()); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/character_count/_index.md b/chinese/rust-cpp/core/character_count/_index.md new file mode 100644 index 00000000000..c2bddcbc036 --- /dev/null +++ b/chinese/rust-cpp/core/character_count/_index.md @@ -0,0 +1,40 @@ +--- +title: "character_count" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 中的字符计数。" +type: docs +url: /zh/rust-cpp/core/character_count/ +--- + +_返回 PDF-document 中的字符计数。_ + +```rust +pub fn character_count(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(i32)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 返回 PDF-document 中的字符计数 + let count = pdf.character_count()?; + + // 打印字符计数 + println!("Character count: {}", count); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/clear_meta_info/_index.md b/chinese/rust-cpp/core/clear_meta_info/_index.md new file mode 100644 index 00000000000..65ee67167d2 --- /dev/null +++ b/chinese/rust-cpp/core/clear_meta_info/_index.md @@ -0,0 +1,40 @@ +--- +title: "clear_meta_info" +second_title: "Aspose.PDF for Rust via C++" +description: "清除 PDF 文档的所有元信息值。" +type: docs +url: /zh/rust-cpp/core/clear_meta_info/ +--- + +_清除 PDF 文档的所有元信息值。_ + +```rust +pub fn clear_meta_info(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 清除 PDF 文档的所有元信息值 + pdf.clear_meta_info()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_clear_meta_info.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/extract_text/_index.md b/chinese/rust-cpp/core/extract_text/_index.md new file mode 100644 index 00000000000..93fdfebb131 --- /dev/null +++ b/chinese/rust-cpp/core/extract_text/_index.md @@ -0,0 +1,40 @@ +--- +title: "extract_text" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF 文档的内容为纯文本。" +type: docs +url: /zh/rust-cpp/core/extract_text/ +--- + +_返回 PDF 文档的内容为纯文本。_ + +```rust +pub fn extract_text(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(String)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 返回 PDF 文档的内容为纯文本 + let txt = pdf.extract_text()?; + + // 打印提取的文本 + println!("Extracted text:\n{}", txt); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/get_meta_info/_index.md b/chinese/rust-cpp/core/get_meta_info/_index.md new file mode 100644 index 00000000000..0c6786d66e2 --- /dev/null +++ b/chinese/rust-cpp/core/get_meta_info/_index.md @@ -0,0 +1,40 @@ +--- +title: "get_meta_info" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF 文档的元信息值。" +type: docs +url: /zh/rust-cpp/core/get_meta_info/ +--- + +_获取 PDF 文档的元信息值。_ + +```rust +pub fn get_meta_info(&self, key: &str) -> Result +``` + +**Arguments** + * **key** - the key whose value to get + +**Returns** + * **Ok(String)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 获取 PDF 文档的元信息值 + let author = pdf.get_meta_info("Author")?; + + // 打印结果 + println!("Author: {}", author); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/is_linearized/_index.md b/chinese/rust-cpp/core/is_linearized/_index.md new file mode 100644 index 00000000000..9fa5ef751fd --- /dev/null +++ b/chinese/rust-cpp/core/is_linearized/_index.md @@ -0,0 +1,41 @@ +--- +title: "is_linearized" +second_title: "Aspose.PDF for Rust via C++" +description: "获取指示文档是否线性化的值。" +type: docs +url: /zh/rust-cpp/core/is_linearized/ +--- + +_获取指示文档是否线性化的值。_ + +```rust +pub fn is_linearized(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 获取指示文档是否线性化的值 + if pdf.is_linearized()? { + println!("The PDF-document is linearized."); + } else { + println!("The PDF-document is non-linearized."); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/merge_documents/_index.md b/chinese/rust-cpp/core/merge_documents/_index.md new file mode 100644 index 00000000000..0b08d2059e4 --- /dev/null +++ b/chinese/rust-cpp/core/merge_documents/_index.md @@ -0,0 +1,43 @@ +--- +title: "merge_documents" +second_title: "Aspose.PDF for Rust via C++" +description: "通过合并提供的 PDF 文档来创建一个新 PDF 文档。" +type: docs +url: /zh/rust-cpp/core/merge_documents/ +--- + +_通过合并提供的 PDF 文档来创建一个新 PDF 文档。_ + +```rust +pub fn merge_documents(documents: &[&Document]) -> Result +``` + +**Arguments** + * **documents** - a slice of references to PDF-documents to merge + +**Returns** + * **Ok((Self))** - with a new PDF-document instance, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf1 = Document::new()?; + + // 打开名为 "sample.pdf" 的 PDF-document + let pdf2 = Document::open("sample.pdf")?; + + // 通过合并提供的 PDF 文档来创建一个新 PDF 文档 + let pdf_merged = Document::merge_documents(&[&pdf1, &pdf2])?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf_merged.save_as("sample_merge_documents.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/new/_index.md b/chinese/rust-cpp/core/new/_index.md new file mode 100644 index 00000000000..4e0b8a18505 --- /dev/null +++ b/chinese/rust-cpp/core/new/_index.md @@ -0,0 +1,37 @@ +--- +title: "new" +second_title: "Aspose.PDF for Rust via C++" +description: "创建一个新的 PDF-document。" +type: docs +url: /zh/rust-cpp/core/new/ +--- + +_创建一个新的 PDF-document._ + +```rust +pub fn new() -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(Self)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_new.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/open/_index.md b/chinese/rust-cpp/core/open/_index.md new file mode 100644 index 00000000000..0d63e4d9522 --- /dev/null +++ b/chinese/rust-cpp/core/open/_index.md @@ -0,0 +1,37 @@ +--- +title: "open" +second_title: "Aspose.PDF for Rust via C++" +description: "使用文件名打开 PDF 文档。" +type: docs +url: /zh/rust-cpp/core/open/ +--- + +_使用文件名打开 PDF 文档。_ + +```rust +pub fn open(filename: &str) -> Result +``` + +**Arguments** + * **filename** - path to the PDF-document to open + +**Returns** + * **Ok(Self)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_open.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_add/_index.md b/chinese/rust-cpp/core/page_add/_index.md new file mode 100644 index 00000000000..037e35c677b --- /dev/null +++ b/chinese/rust-cpp/core/page_add/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_add" +second_title: "Aspose.PDF for Rust via C++" +description: "向 PDF-document 添加新页面。" +type: docs +url: /zh/rust-cpp/core/page_add/ +--- + +_向 PDF-document 添加新页面。_ + +```rust +pub fn page_add(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 在 PDF-document 中添加新页面 + pdf.page_add()?; + + // 保存先前打开的 PDF-document + pdf.save()?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_character_count/_index.md b/chinese/rust-cpp/core/page_character_count/_index.md new file mode 100644 index 00000000000..6599c310cd8 --- /dev/null +++ b/chinese/rust-cpp/core/page_character_count/_index.md @@ -0,0 +1,44 @@ +--- +title: "page_character_count" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 中指定页面的字符计数。" +type: docs +url: /zh/rust-cpp/core/page_character_count/ +--- + +_返回 PDF-document 中指定页面的字符计数。_ + +```rust +pub fn page_character_count(&self) -> Result +``` + +**Arguments** + * **num** - the page number (1-based) + + +**Returns** + * **Ok(i32)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 指定页码(基于 1 的索引) + let page_number = 1; + + // 返回指定页面的字符计数 + let count = pdf.page_character_count(page_number)?; + + // 打印字符计数 + println!("Character count on page {}: {}", page_number, count); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_count/_index.md b/chinese/rust-cpp/core/page_count/_index.md new file mode 100644 index 00000000000..b87e20ca935 --- /dev/null +++ b/chinese/rust-cpp/core/page_count/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_count" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF 文档的页数。" +type: docs +url: /zh/rust-cpp/core/page_count/ +--- + +_返回 PDF 文档的页数。_ + +```rust +pub fn page_count(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(i32)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 返回 PDF 文档的页数 + let count = pdf.page_count()?; + + // 打印页数 + println!("Count: {}", count); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_delete/_index.md b/chinese/rust-cpp/core/page_delete/_index.md new file mode 100644 index 00000000000..0d6f86a3367 --- /dev/null +++ b/chinese/rust-cpp/core/page_delete/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_delete" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中删除指定的页面。" +type: docs +url: /zh/rust-cpp/core/page_delete/ +--- + +_从 PDF-document 中删除指定的页面._ + +```rust +pub fn page_delete(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-document 中指定的页面 + pdf.page_delete(1)?; + + // 保存先前打开的 PDF-document + pdf.save()?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_insert/_index.md b/chinese/rust-cpp/core/page_insert/_index.md new file mode 100644 index 00000000000..499bf187c07 --- /dev/null +++ b/chinese/rust-cpp/core/page_insert/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_insert" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF-document 的指定位置插入新页面." +type: docs +url: /zh/rust-cpp/core/page_insert/ +--- + +_在 PDF-document 的指定位置插入新页面._ + +```rust +pub fn page_insert(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 在 PDF-document 的指定位置插入新页面 + pdf.page_insert(1)?; + + // 保存先前打开的 PDF-document + pdf.save()?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_is_blank/_index.md b/chinese/rust-cpp/core/page_is_blank/_index.md new file mode 100644 index 00000000000..6399d6d8c26 --- /dev/null +++ b/chinese/rust-cpp/core/page_is_blank/_index.md @@ -0,0 +1,44 @@ +--- +title: "page_is_blank" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 中页面是否为空白。" +type: docs +url: /zh/rust-cpp/core/page_is_blank/ +--- + +_返回 PDF 文档中的页面为空。_ + +```rust +pub fn page_is_blank(&self, num: i32) -> Result +``` + +**Arguments** + * **num** - the page number (1-based) + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 指定页码(基于 1 的索引) + let page_number = 1; + + // 返回 PDF 文档中的页面为空 + let is_blank = pdf.page_is_blank(page_number)?; + + // 如果指定的页面为空则打印 + println!("Is page {} blank? {}", page_number, is_blank); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/page_word_count/_index.md b/chinese/rust-cpp/core/page_word_count/_index.md new file mode 100644 index 00000000000..a29885fe3b3 --- /dev/null +++ b/chinese/rust-cpp/core/page_word_count/_index.md @@ -0,0 +1,44 @@ +--- +title: "page_word_count" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 中指定页面的字数。" +type: docs +url: /zh/rust-cpp/core/page_word_count/ +--- + +_返回 PDF-document 中指定页面的字数._ + +```rust +pub fn page_word_count(&self) -> Result +``` + +**Arguments** + * **num** - the page number (1-based) + + +**Returns** + * **Ok(i32)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 指定页码(基于 1 的索引) + let page_number = 1; + + // 返回指定页面的字数 + let count = pdf.page_word_count(page_number)?; + + // 打印字数 + println!("Word count on page {}: {}", page_number, count); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/save/_index.md b/chinese/rust-cpp/core/save/_index.md new file mode 100644 index 00000000000..389175beb57 --- /dev/null +++ b/chinese/rust-cpp/core/save/_index.md @@ -0,0 +1,37 @@ +--- +title: "save" +second_title: "Aspose.PDF for Rust via C++" +description: "保存先前打开的 PDF-document。" +type: docs +url: /zh/rust-cpp/core/save/ +--- + +_保存先前打开的 PDF-document._ + +```rust +pub fn save(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 保存先前打开的 PDF-document + pdf.save()?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/save_as/_index.md b/chinese/rust-cpp/core/save_as/_index.md new file mode 100644 index 00000000000..190b97928d1 --- /dev/null +++ b/chinese/rust-cpp/core/save_as/_index.md @@ -0,0 +1,37 @@ +--- +title: "save_as" +second_title: "Aspose.PDF for Rust via C++" +description: "将先前打开的 PDF-document 另存为新文件名。" +type: docs +url: /zh/rust-cpp/core/save_as/ +--- + +_将先前打开的 PDF-document 另存为新文件名._ + +```rust +pub fn save_as(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the output file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 将 PDF-document 保存为新文件名 + pdf.save_as("sample_save_as.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/set_license/_index.md b/chinese/rust-cpp/core/set_license/_index.md new file mode 100644 index 00000000000..97a36f06d9b --- /dev/null +++ b/chinese/rust-cpp/core/set_license/_index.md @@ -0,0 +1,40 @@ +--- +title: "set_license" +second_title: "Aspose.PDF for Rust via C++" +description: "使用文件名设置许可证。" +type: docs +url: /zh/rust-cpp/core/set_license/ +--- + +_使用文件名设置许可证。_ + +```rust +pub fn set_license(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the license-file + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 使用文件名设置许可证 + pdf.set_license("Aspose.PDF.RustViaCPP.lic")?; + + // 现在您可以使用已授权的 PDF 文档 + // ... + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/set_meta_info/_index.md b/chinese/rust-cpp/core/set_meta_info/_index.md new file mode 100644 index 00000000000..37b2adb7070 --- /dev/null +++ b/chinese/rust-cpp/core/set_meta_info/_index.md @@ -0,0 +1,41 @@ +--- +title: "set_meta_info" +second_title: "Aspose.PDF for Rust via C++" +description: "设置 PDF 文档的元信息值。" +type: docs +url: /zh/rust-cpp/core/set_meta_info/ +--- + +_设置 PDF 文档的元信息值。_ + +```rust +pub fn set_meta_info(&self, key: &str, value: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **key** - the key whose value to set + * **value** - the value to be set + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 设置 PDF 文档的元信息值 + pdf.set_meta_info("Author", "Aspose")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_set_meta_info.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/split/_index.md b/chinese/rust-cpp/core/split/_index.md new file mode 100644 index 00000000000..4bf0d7f9d19 --- /dev/null +++ b/chinese/rust-cpp/core/split/_index.md @@ -0,0 +1,43 @@ +--- +title: "split" +second_title: "Aspose.PDF for Rust via C++" +description: "通过从当前 PDF 文档提取页面来创建多个新 PDF 文档。" +type: docs +url: /zh/rust-cpp/core/split/ +--- + +_通过从当前 PDF 文档提取页面来创建多个新 PDF 文档。_ + +```rust +pub fn split(&self, page_range: &str) -> Result, PdfError> +``` + +**Arguments** + * **page_range** - a string specifying page ranges, e.g. `"1-2;3;4-"` + +**Returns** + * **Ok(Vec\)** - containing the resulting split documents, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf_split = Document::open("sample.pdf")?; + + // 通过从当前 PDF 文档提取页面来创建多个新 PDF 文档 + let pdf_parts = pdf_split.split("1-2;3-")?; + + // 将每个拆分部分保存为单独的 PDF-document + for (i, pdf_part) in pdf_parts.iter().enumerate() { + let pdf_filename = format!("sample_split_part{}.pdf", i + 1); + pdf_part.save_as(&pdf_filename)?; + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/split_at/_index.md b/chinese/rust-cpp/core/split_at/_index.md new file mode 100644 index 00000000000..8418af838e2 --- /dev/null +++ b/chinese/rust-cpp/core/split_at/_index.md @@ -0,0 +1,41 @@ +--- +title: "split_at" +second_title: "Aspose.PDF for Rust via C++" +description: "将当前 PDF-document 拆分为两个新的 PDF-documents。" +type: docs +url: /zh/rust-cpp/core/split_at/ +--- + +_将当前 PDF-document 拆分为两个新的 PDF-documents._ + +```rust +pub fn split_at(&self, page: i32) -> Result<(Self, Self), PdfError> +``` + +**Arguments** + * **page** - a page number at which to split (1-based, exclusive for the second part) + +**Returns** + * **Ok((Self, Self))** - with the two split documents, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf_split = Document::open("sample.pdf")?; + + // 将当前 PDF-document 拆分为两个新的 PDF-documents + let (left, right) = pdf_split.split_at(2)?; + + // 将每个拆分部分保存为单独的 PDF-document + left.save_as("sample_split_at_left.pdf")?; + right.save_as("sample_split_at_right.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/split_at_page/_index.md b/chinese/rust-cpp/core/split_at_page/_index.md new file mode 100644 index 00000000000..3946aad28f9 --- /dev/null +++ b/chinese/rust-cpp/core/split_at_page/_index.md @@ -0,0 +1,42 @@ +--- +title: "split_at_page" +second_title: "Aspose.PDF for Rust via C++" +description: "将 PDF-document 拆分为两个新的 PDF-documents." +type: docs +url: /zh/rust-cpp/core/split_at_page/ +--- + +_将 PDF-document 拆分为两个新的 PDF-documents._ + +```rust +pub fn split_at_page(document: &Document, page: i32) -> Result<(Self, Self), PdfError> +``` + +**Arguments** + * **document** - a reference to the source PDF-document to split + * **page** - a page number at which to split (1-based, exclusive for the second part) + +**Returns** + * **Ok((Self, Self))** - with the two split documents, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf_split = Document::open("sample.pdf")?; + + // 将 PDF-document 拆分为两个新的 PDF-documents + let (left, right) = Document::split_at_page(&pdf_split, 2)?; + + // 将每个拆分部分保存为单独的 PDF-document + left.save_as("sample_split_at_page_left.pdf")?; + right.save_as("sample_split_at_page_right.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/split_document/_index.md b/chinese/rust-cpp/core/split_document/_index.md new file mode 100644 index 00000000000..79ccc9a8ef0 --- /dev/null +++ b/chinese/rust-cpp/core/split_document/_index.md @@ -0,0 +1,44 @@ +--- +title: "split_document" +second_title: "Aspose.PDF for Rust via C++" +description: "通过从源 PDF-document 中提取页面来创建多个新的 PDF-documents." +type: docs +url: /zh/rust-cpp/core/split_document/ +--- + +_通过从源 PDF-document 中提取页面来创建多个新的 PDF-documents._ + +```rust +pub fn split_document(document: &Document, page_range: &str) -> Result, PdfError> +``` + +**Arguments** + * **document** - a reference to the source PDF-document to split + * **page_range** - a string specifying page ranges, e.g. `"1-2;3;4-"` + +**Returns** + * **Ok(Vec\)** - containing the resulting split documents, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample.pdf" 的 PDF-document + let pdf_split = Document::open("sample.pdf")?; + + // 通过从源 PDF-document 中提取页面来创建多个新的 PDF-documents + let pdf_parts = Document::split_document(&pdf_split, "1;2-")?; + + // 将每个拆分部分保存为单独的 PDF-document + for (i, pdf_part) in pdf_parts.iter().enumerate() { + let pdf_filename = format!("sample_split_document_part{}.pdf", i + 1); + pdf_part.save_as(&pdf_filename)?; + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/core/word_count/_index.md b/chinese/rust-cpp/core/word_count/_index.md new file mode 100644 index 00000000000..02477c8c852 --- /dev/null +++ b/chinese/rust-cpp/core/word_count/_index.md @@ -0,0 +1,40 @@ +--- +title: "word_count" +second_title: "Aspose.PDF for Rust via C++" +description: "返回 PDF-document 中的字数。" +type: docs +url: /zh/rust-cpp/core/word_count/ +--- + +_返回 PDF-document 中的字数._ + +```rust +pub fn word_count(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(i32)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 返回 PDF-document 中的字数 + let count = pdf.word_count()?; + + // 打印字数 + println!("Word count: {}", count); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/miscellaneous/_index.md b/chinese/rust-cpp/miscellaneous/_index.md new file mode 100644 index 00000000000..f69ef384c71 --- /dev/null +++ b/chinese/rust-cpp/miscellaneous/_index.md @@ -0,0 +1,19 @@ +--- +title: "杂项功能" +second_title: "Aspose.PDF for Rust via C++" +description: "用于处理的杂项功能。" +type: docs +url: /zh/rust-cpp/miscellaneous/ +--- + +## Miscellaneous + +| 函数 | 描述 | +| -------- | ----------- | +| [about](./about/) | 返回关于通过 C++ 使用的 Aspose.PDF for Rust 的元数据信息。 | + + +## Detailed Description + +用于处理的杂项功能。 + diff --git a/chinese/rust-cpp/miscellaneous/about/_index.md b/chinese/rust-cpp/miscellaneous/about/_index.md new file mode 100644 index 00000000000..869a42de479 --- /dev/null +++ b/chinese/rust-cpp/miscellaneous/about/_index.md @@ -0,0 +1,69 @@ +--- +title: "关于" +second_title: "Aspose.PDF for Rust via C++" +description: "返回关于 Aspose.PDF for Rust 通过 C++ 的元数据信息。" +type: docs +url: /zh/rust-cpp/miscellaneous/about/ +--- + +_返回关于 Aspose.PDF for Rust 通过 C++ 的元数据信息。_ + +```rust +pub fn about(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(ProductInfo)** - if the operation succeeds +```rust +#[derive(Debug, Deserialize)] +pub struct ProductInfo { + #[serde(rename = "product")] + pub product: String, + + #[serde(rename = "family")] + pub family: String, + + #[serde(rename = "version")] + pub version: String, + + #[serde(rename = "releasedate")] + pub release_date: String, + + #[serde(rename = "producer")] + pub producer: String, + + #[serde(rename = "islicensed")] + pub is_licensed: bool, +} +``` + + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 返回关于 Aspose.PDF for Go 通过 C++ 的元数据信息。 + let info = pdf.about()?; + + // 打印元数据字段 + println!("Product Info:"); + println!(" Product: {}", info.product); + println!(" Family: {}", info.family); + println!(" Version: {}", info.version); + println!(" ReleaseDate: {}", info.release_date); + println!(" Producer: {}", info.producer); + println!(" IsLicensed: {}", info.is_licensed); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/_index.md b/chinese/rust-cpp/organize/_index.md new file mode 100644 index 00000000000..34b8e1f198e --- /dev/null +++ b/chinese/rust-cpp/organize/_index.md @@ -0,0 +1,71 @@ +--- +title: "组织 PDF 功能" +second_title: "Aspose.PDF for Rust via C++" +description: "用于组织 PDF 文件的功能。" +type: docs +url: /zh/rust-cpp/organize/ +--- + +## Organize PDF functions + +| 名称 | 描述 | +| -------------- | -------------- | +| [optimize](./optimize/) | 优化 PDF-文档的内容。 | +| [optimize_resource](./optimize_resource/) | 优化 PDF-文档的资源。 | +| [grayscale](./grayscale/) | 将 PDF-文档 转换为黑白。 | +| [rotate](./rotate/) | 旋转 PDF-文档。 | +| [set_background](./set_background/) | 使用 RGB 值设置 PDF-文档 的背景颜色。 | +| [repair](./repair/) | 修复 PDF-文档。 | +| [replace_text](./replace_text/) | 替换 PDF-文档 中的文本 | +| [add_page_num](./add_page_num/) | 向 PDF-文档 添加页码 | +| [add_text_header](./add_text_header/) | 在 PDF-文档 的页眉中添加文本 | +| [add_text_footer](./add_text_footer/) | 在 PDF-文档 的页脚中添加文本 | +| [flatten](./flatten/) | 扁平化 PDF-文档 | +| [remove_annotations](./remove_annotations/) | 删除 PDF-文档 中的批注 | +| [remove_attachments](./remove_attachments/) | 删除 PDF-文档 中的附件 | +| [remove_blank_pages](./remove_blank_pages/) | 删除 PDF-文档 中的空白页 | +| [remove_bookmarks](./remove_bookmarks/) | 删除 PDF-文档 中的书签 | +| [remove_hidden_text](./remove_hidden_text/) | 删除 PDF-文档 中的隐藏文本 | +| [remove_images](./remove_images/) | 删除 PDF-文档 中的图像 | +| [remove_javascripts](./remove_javascripts/) | 删除 PDF-文档 中的 Java 脚本 | +| [remove_tables](./remove_tables/) | 删除 PDF-文档 中的表格。 | +| [remove_watermarks](./remove_watermarks/) | 删除 PDF-文档 中的水印。 | +| [add_watermark](./add_watermark/) | 向 PDF-文档 添加水印。 | +| [embed_fonts](./embed_fonts/) | 在 PDF 文档中嵌入字体。 | +| [unembed_fonts](./unembed_fonts/) | 在 PDF 文档中取消嵌入字体。 | +| [optimize_file_size](./optimize_file_size/) | 通过图像压缩质量优化 PDF 文档的大小。 | +| [remove_text_headers](./remove_text_headers/) | 从 PDF 文档中移除文本页眉。 | +| [remove_text_footers](./remove_text_footers/) | 从 PDF 文档中移除文本页脚。 | +| [crop](./crop/) | 裁剪 PDF 文档的页面。 | +| [replace_font](./replace_font/) | 在 PDF 文档中替换字体。 | +| [convert](./convert/) | 将 PDF 文档转换为具有指定 PDF 格式的 PDF 文档 | +| [validate](./validate/) | 验证 PDF 文档是否符合 PDF 格式的规范 | +| [remove_pdfa_compliance](./remove_pdfa_compliance/) | 从 PDF 文档中移除 PDF/A 合规性 | +| [remove_pdfua_compliance](./remove_pdfua_compliance/) | 从 PDF 文档中移除 PDF/UA 合规性 | +| [is_pdfa_compliant](./is_pdfa_compliant/) | 获取 PDF 文档是否符合 PDF/A 标准 | +| [is_pdfua_compliant](./is_pdfua_compliant/) | 获取 PDF 文档是否符合 PDF/UA 标准 | +| [page_rotate](./page_rotate/) | 旋转 PDF 文档中的页面。 | +| [page_set_size](./page_set_size/) | 设置 PDF 文档中页面的大小。 | +| [page_grayscale](./page_grayscale/) | 将页面转换为黑白。 | +| [page_add_text](./page_add_text/) | 在页面上添加文本。 | +| [page_replace_text](./page_replace_text/) | 在页面上替换文本 | +| [page_add_page_num](./page_add_page_num/) | 在页面上添加页码 | +| [page_add_text_header](./page_add_text_header/) | 在页面页眉中添加文本 | +| [page_add_text_footer](./page_add_text_footer/) | 在页面页脚中添加文本 | +| [page_remove_annotations](./page_remove_annotations/) | 移除页面中的批注。 | +| [page_remove_hidden_text](./page_remove_hidden_text/) | 移除页面中的隐藏文本。 | +| [page_remove_images](./page_remove_images/) | 移除页面中的图像。 | +| [page_remove_tables](./page_remove_tables/) | 移除页面中的表格。 | +| [page_remove_watermarks](./page_remove_watermarks/) | 删除页面中的水印。 | +| [page_add_watermark](./page_add_watermark/) | 在页面上添加水印。 | +| [page_remove_text_headers](./page_remove_text_headers/) | 删除页面中的文本页眉。 | +| [page_remove_text_footers](./page_remove_text_footers/) | 删除页面中的文本页脚。 | +| [page_crop](./page_crop/) | 裁剪页面。 | +| [page_replace_font](./page_replace_font/) | 替换页面中的字体。 | +| [page_merge_layers](./page_merge_layers/) | 将页面上的所有图层合并为单个图层,并使用指定的新图层名称。 | +| [page_layers](./page_layers/) | 获取页面上图层的名称。 | + + +## Detailed Description + +用于组织 PDF 文件的功能。 diff --git a/chinese/rust-cpp/organize/add_page_num/_index.md b/chinese/rust-cpp/organize/add_page_num/_index.md new file mode 100644 index 00000000000..c4d724665b9 --- /dev/null +++ b/chinese/rust-cpp/organize/add_page_num/_index.md @@ -0,0 +1,40 @@ +--- +title: "add_page_num" +second_title: "Aspose.PDF for Rust via C++" +description: "向 PDF-document 添加页码。" +type: docs +url: /zh/rust-cpp/organize/add_page_num/ +--- + +_向 PDF-document 添加页码._ + +```rust +pub fn add_page_num(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 向 PDF-文档 添加页码 + pdf.add_page_num()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_add_page_num.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/add_text_footer/_index.md b/chinese/rust-cpp/organize/add_text_footer/_index.md new file mode 100644 index 00000000000..c890bd6190a --- /dev/null +++ b/chinese/rust-cpp/organize/add_text_footer/_index.md @@ -0,0 +1,40 @@ +--- +title: "add_text_footer" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF-document 的页脚添加文本。" +type: docs +url: /zh/rust-cpp/organize/add_text_footer/ +--- + +_在 PDF-document 的页脚添加文本._ + +```rust +pub fn add_text_footer(&self, footer: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **footer** - the pages footer + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在 PDF-文档 的页脚中添加文本 + pdf.add_text_footer("FOOTER")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_add_text_footer.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/add_text_header/_index.md b/chinese/rust-cpp/organize/add_text_header/_index.md new file mode 100644 index 00000000000..f89a0d05d33 --- /dev/null +++ b/chinese/rust-cpp/organize/add_text_header/_index.md @@ -0,0 +1,40 @@ +--- +title: "add_text_header" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF 文档的页眉中添加文本。" +type: docs +url: /zh/rust-cpp/organize/add_text_header/ +--- + +_在 PDF 文档的页眉中添加文本。_ + +```rust +pub fn add_text_header(&self, header: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **header** - the pages header + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在 PDF-文档 的页眉中添加文本 + pdf.add_text_header("HEADER")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_add_text_header.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/add_watermark/_index.md b/chinese/rust-cpp/organize/add_watermark/_index.md new file mode 100644 index 00000000000..807e0637d4c --- /dev/null +++ b/chinese/rust-cpp/organize/add_watermark/_index.md @@ -0,0 +1,69 @@ +--- +title: "add_watermark" +second_title: "Aspose.PDF for Rust via C++" +description: "向 PDF-document 添加水印。" +type: docs +url: /zh/rust-cpp/organize/add_watermark/ +--- + +_向 PDF-document 添加水印._ + +```rust +pub fn add_watermark( + &self, + text: &str, + font_name: &str, + font_size: f64, + foreground_color: &str, + x_position: i32, + y_position: i32, + rotation: i32, + is_background: bool, + opacity: f64, +) -> Result<(), PdfError> +``` + +**Arguments** + * **text** - the watermark text + * **font_name** - the font name + * **font_size** - the font size + * **foreground_color** - the text color (hexadecimal format "#RRGGBB", where RR-red, GG-green and BB-blue hexadecimal integers) + * **x_position** - the 'x' watermark position + * **y_position** - the 'y' watermark position + * **rotation** - the watermark rotation (0-360) + * **is_background** - the background + * **opacity** - the opacity (decimal) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 向 PDF-document 添加水印 + pdf.add_watermark( + "WATERMARK", + "Arial", + 16.0, + "#010101", + 100, + 100, + 45, + true, + 0.5, + )?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_add_watermark.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/convert/_index.md b/chinese/rust-cpp/organize/convert/_index.md new file mode 100644 index 00000000000..6835e06ffb0 --- /dev/null +++ b/chinese/rust-cpp/organize/convert/_index.md @@ -0,0 +1,49 @@ +--- +title: "convert" +second_title: "Aspose.PDF for Rust via C++" +description: "将 PDF-document 转换为具有指定 PDF 格式的 PDF-document。" +type: docs +url: /zh/rust-cpp/organize/convert/ +--- + +_将 PDF-document 转换为具有指定 PDF 格式的 PDF-document._ + +```rust + pub fn convert( + &self, + pdf_format: PdfFormat, + action: ConvertErrorAction, + ) -> Result<(bool, String), PdfError> +``` + +**Arguments** + * **pdf_format** - the target PDF format standard (enum [PdfFormat](../../)) + * **action** - the action to take on conversion errors (enum [ConvertErrorAction](../../)) + +**Returns** + * **Ok((bool, String))** - the operation result, `String` contains the conversion log + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{ConvertErrorAction, Document, PdfFormat}; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将 PDF 文档转换为具有指定 PDF 格式的 PDF 文档 + let (ok, log) = pdf.convert(PdfFormat::PDF_A_2A, ConvertErrorAction::Delete)?; + + // 打印转换结果和完整日志 + println!("Convert PDF/A result: {}", ok); + println!("Convert PDF/A log:\n{}", log); + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_convert.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/crop/_index.md b/chinese/rust-cpp/organize/crop/_index.md new file mode 100644 index 00000000000..8f54e628116 --- /dev/null +++ b/chinese/rust-cpp/organize/crop/_index.md @@ -0,0 +1,40 @@ +--- +title: "裁剪" +second_title: "Aspose.PDF for Rust via C++" +description: "裁剪 PDF-document 的页面。" +type: docs +url: /zh/rust-cpp/organize/crop/ +--- + +_裁剪 PDF-document 的页面._ + +```rust +pub fn crop(&self, margin: f64) -> Result<(), PdfError> +``` + +**Arguments** + * **margin** - pages margins + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 裁剪 PDF-document 的页面 + pdf.crop(10.5)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_crop.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/embed_fonts/_index.md b/chinese/rust-cpp/organize/embed_fonts/_index.md new file mode 100644 index 00000000000..f8ad24bf25d --- /dev/null +++ b/chinese/rust-cpp/organize/embed_fonts/_index.md @@ -0,0 +1,40 @@ +--- +title: "embed_fonts" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF-document 中嵌入字体。" +type: docs +url: /zh/rust-cpp/organize/embed_fonts/ +--- + +_在 PDF-document 中嵌入字体._ + +```rust +pub fn embed_fonts(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在 PDF-document 中嵌入字体 + pdf.embed_fonts()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_embed_fonts.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/flatten/_index.md b/chinese/rust-cpp/organize/flatten/_index.md new file mode 100644 index 00000000000..50163720f15 --- /dev/null +++ b/chinese/rust-cpp/organize/flatten/_index.md @@ -0,0 +1,40 @@ +--- +title: "flatten" +second_title: "Aspose.PDF for Rust via C++" +description: "将 PDF 文档扁平化。" +type: docs +url: /zh/rust-cpp/organize/flatten/ +--- + +_将 PDF 文档扁平化。_ + +```rust +pub fn flatten(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 返回 PDF 文档的内容为纯文本 + let txt = pdf.extract_text()?; + + // 打印提取的文本 + println!("Extracted text:\n{}", txt); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/grayscale/_index.md b/chinese/rust-cpp/organize/grayscale/_index.md new file mode 100644 index 00000000000..14b770fe7ae --- /dev/null +++ b/chinese/rust-cpp/organize/grayscale/_index.md @@ -0,0 +1,40 @@ +--- +title: "grayscale" +second_title: "Aspose.PDF for Rust via C++" +description: "将 PDF 文档转换为黑白。" +type: docs +url: /zh/rust-cpp/organize/grayscale/ +--- + +_将 PDF 文档转换为黑白。_ + +```rust +pub fn grayscale(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 将 PDF 文档转换为黑白 + pdf.grayscale()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_grayscale.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/is_pdfa_compliant/_index.md b/chinese/rust-cpp/organize/is_pdfa_compliant/_index.md new file mode 100644 index 00000000000..9038e6e77c6 --- /dev/null +++ b/chinese/rust-cpp/organize/is_pdfa_compliant/_index.md @@ -0,0 +1,41 @@ +--- +title: "is_pdfa_compliant" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF-document 是否符合 PDF/A。" +type: docs +url: /zh/rust-cpp/organize/is_pdfa_compliant/ +--- + +_获取 PDF-document 是否符合 PDF/A._ + +```rust +pub fn is_pdfa_compliant(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 获取 PDF-document 的 PDF/A 合规状态 + if pdf.is_pdfa_compliant()? { + println!("The document is PDF/A compliant."); + } else { + println!("The document is not PDF/A compliant."); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/is_pdfua_compliant/_index.md b/chinese/rust-cpp/organize/is_pdfua_compliant/_index.md new file mode 100644 index 00000000000..ed752b9f821 --- /dev/null +++ b/chinese/rust-cpp/organize/is_pdfua_compliant/_index.md @@ -0,0 +1,41 @@ +--- +title: "is_pdfua_compliant" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF 文档是否符合 PDF/UA 标准。" +type: docs +url: /zh/rust-cpp/organize/is_pdfua_compliant/ +--- + +_获取 PDF 文档是否符合 PDF/UA 标准。_ + +```rust +pub fn is_pdfua_compliant(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 获取 PDF 文档的 PDF/UA 合规状态 + if pdf.is_pdfua_compliant()? { + println!("The document is PDF/UA compliant."); + } else { + println!("The document is not PDF/UA compliant."); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/optimize/_index.md b/chinese/rust-cpp/organize/optimize/_index.md new file mode 100644 index 00000000000..11f48ebb14a --- /dev/null +++ b/chinese/rust-cpp/organize/optimize/_index.md @@ -0,0 +1,40 @@ +--- +title: "optimize" +second_title: "Aspose.PDF for Rust via C++" +description: "优化 PDF 文档内容。" +type: docs +url: /zh/rust-cpp/organize/optimize/ +--- + +_优化 PDF 文档内容。_ + +```rust +pub fn optimize(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 优化 PDF 文档内容 + pdf.optimize()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_optimize.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/optimize_file_size/_index.md b/chinese/rust-cpp/organize/optimize_file_size/_index.md new file mode 100644 index 00000000000..f4d90ebc105 --- /dev/null +++ b/chinese/rust-cpp/organize/optimize_file_size/_index.md @@ -0,0 +1,40 @@ +--- +title: "optimize_file_size" +second_title: "Aspose.PDF for Rust via C++" +description: "通过图像压缩质量优化 PDF 文档的大小。" +type: docs +url: /zh/rust-cpp/organize/optimize_file_size/ +--- + +_通过图像压缩质量优化 PDF 文档的大小。_ + +```rust +pub fn optimize_file_size(&self, image_quality: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **image_quality** - the image compression quality + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 优化 PDF 文档的大小,使用图像压缩质量 + pdf.optimize_file_size(50)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_optimize_file_size.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/optimize_resource/_index.md b/chinese/rust-cpp/organize/optimize_resource/_index.md new file mode 100644 index 00000000000..bac79c84bc7 --- /dev/null +++ b/chinese/rust-cpp/organize/optimize_resource/_index.md @@ -0,0 +1,40 @@ +--- +title: "optimize_resource" +second_title: "Aspose.PDF for Rust via C++" +description: "优化 PDF-document 的资源。" +type: docs +url: /zh/rust-cpp/organize/optimize_resource/ +--- + +_优化 PDF-document 的资源._ + +```rust +pub fn optimize_resource(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 优化 PDF-document 的资源 + pdf.optimize_resource()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_optimize_resource.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_add_page_num/_index.md b/chinese/rust-cpp/organize/page_add_page_num/_index.md new file mode 100644 index 00000000000..4b19a8cd898 --- /dev/null +++ b/chinese/rust-cpp/organize/page_add_page_num/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_add_page_num" +second_title: "Aspose.PDF for Rust via C++" +description: "在页面上添加页码。" +type: docs +url: /zh/rust-cpp/organize/page_add_page_num/ +--- + +_在页面上添加页码。_ + +```rust +pub fn page_add_page_num(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在页面上添加页码 + pdf.page_add_page_num(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_add_page_num.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_add_text/_index.md b/chinese/rust-cpp/organize/page_add_text/_index.md new file mode 100644 index 00000000000..a515ada295a --- /dev/null +++ b/chinese/rust-cpp/organize/page_add_text/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_add_text" +second_title: "Aspose.PDF for Rust via C++" +description: "向页面添加文本。" +type: docs +url: /zh/rust-cpp/organize/page_add_text/ +--- + +_向页面添加文本._ + +```rust +pub fn page_add_text(&self, num: i32, add_text: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **add_text** - the text to add + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 在页面上添加文本 + pdf.page_add_text(1, "added text")?; + + // 保存先前打开的 PDF-document + pdf.save()?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_add_text_footer/_index.md b/chinese/rust-cpp/organize/page_add_text_footer/_index.md new file mode 100644 index 00000000000..0b7fa09c223 --- /dev/null +++ b/chinese/rust-cpp/organize/page_add_text_footer/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_add_text_footer" +second_title: "Aspose.PDF for Rust via C++" +description: "在页面页脚添加文本。" +type: docs +url: /zh/rust-cpp/organize/page_add_text_footer/ +--- + +_在页面页脚添加文本。_ + +```rust +pub fn page_add_text_footer(&self, num: i32, footer: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **footer** - the pages footer + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在页面页脚中添加文本 + pdf.page_add_text_footer(1, "FOOTER")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_add_text_footer.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_add_text_header/_index.md b/chinese/rust-cpp/organize/page_add_text_header/_index.md new file mode 100644 index 00000000000..5d6e6410b91 --- /dev/null +++ b/chinese/rust-cpp/organize/page_add_text_header/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_add_text_header" +second_title: "Aspose.PDF for Rust via C++" +description: "在页面标题中添加文本。" +type: docs +url: /zh/rust-cpp/organize/page_add_text_header/ +--- + +_在页面标题中添加文本._ + +```rust +pub fn page_add_text_header(&self, num: i32, header: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **header** - the pages header + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在页面页眉中添加文本 + pdf.page_add_text_header(1, "HEADER")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_add_text_header.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_add_watermark/_index.md b/chinese/rust-cpp/organize/page_add_watermark/_index.md new file mode 100644 index 00000000000..e02d4c4ff07 --- /dev/null +++ b/chinese/rust-cpp/organize/page_add_watermark/_index.md @@ -0,0 +1,72 @@ +--- +title: "page_add_watermark" +second_title: "Aspose.PDF for Rust via C++" +description: "在页面上添加水印。" +type: docs +url: /zh/rust-cpp/organize/page_add_watermark/ +--- + +_在页面上添加水印._ + +```rust +pub fn page_add_watermark( + &self, + num: i32, + text: &str, + font_name: &str, + font_size: f64, + foreground_color: &str, + x_position: i32, + y_position: i32, + rotation: i32, + is_background: bool, + opacity: f64, +) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **text** - the watermark text + * **font_name** - the font name + * **font_size** - the font size + * **foreground_color** - the text color (hexadecimal format "#RRGGBB", where RR-red, GG-green and BB-blue hexadecimal integers) + * **x_position** - the 'x' watermark position + * **y_position** - the 'y' watermark position + * **rotation** - the watermark rotation (0-360) + * **is_background** - the background + * **opacity** - the opacity (decimal) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在页面上添加水印 + pdf.page_add_watermark( + 1, + "WATERMARK", + "Arial", + 16.0, + "#010101", + 100, + 100, + 45, + true, + 0.5, + )?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_add_watermark.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_crop/_index.md b/chinese/rust-cpp/organize/page_crop/_index.md new file mode 100644 index 00000000000..c01c28195f4 --- /dev/null +++ b/chinese/rust-cpp/organize/page_crop/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_crop" +second_title: "Aspose.PDF for Rust via C++" +description: "裁剪页面。" +type: docs +url: /zh/rust-cpp/organize/page_crop/ +--- + +_裁剪页面._ + +```rust +pub fn page_crop(&self, num: i32, margin: f64) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **margin** - page margins + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 裁剪页面 + pdf.page_crop(1, 1.0)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_crop.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_grayscale/_index.md b/chinese/rust-cpp/organize/page_grayscale/_index.md new file mode 100644 index 00000000000..fcac4132b51 --- /dev/null +++ b/chinese/rust-cpp/organize/page_grayscale/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_grayscale" +second_title: "Aspose.PDF for Rust via C++" +description: "将页面转换为黑白。" +type: docs +url: /zh/rust-cpp/organize/page_grayscale/ +--- + +_将页面转换为黑白。_ + +```rust +pub fn page_grayscale(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 将页面转换为黑白 + pdf.page_grayscale(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_grayscale.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_layers/_index.md b/chinese/rust-cpp/organize/page_layers/_index.md new file mode 100644 index 00000000000..5970c83dee3 --- /dev/null +++ b/chinese/rust-cpp/organize/page_layers/_index.md @@ -0,0 +1,42 @@ +--- +title: "page_layers" +second_title: "Aspose.PDF for Rust via C++" +description: "获取页面上图层的名称。" +type: docs +url: /zh/rust-cpp/organize/page_layers/ +--- + +_获取页面上图层的名称。_ + +```rust +pub fn page_layers(&self, num: i32) -> Result, PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(Vec\)** - the array layers' names + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample_layers.pdf")?; + + // 获取第 1 页上图层的名称 + let layers: Vec = pdf.page_layers(1)?; + + println!("Layers on page 1:"); + for name in layers { + println!("- {}", name); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_merge_layers/_index.md b/chinese/rust-cpp/organize/page_merge_layers/_index.md new file mode 100644 index 00000000000..e04127be55e --- /dev/null +++ b/chinese/rust-cpp/organize/page_merge_layers/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_merge_layers" +second_title: "Aspose.PDF for Rust via C++" +description: "将页面上的所有图层合并为单个图层,使用指定的新图层名称。" +type: docs +url: /zh/rust-cpp/organize/page_merge_layers/ +--- + +_将页面上的所有图层合并为单个图层,使用指定的新图层名称。_ + +```rust +pub fn page_merge_layers(&self, num: i32, new_layer_name: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **new_layer_name** - the name of the new layer after merging + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 将页面上的所有图层合并为单个图层,使用指定的新图层名称 + pdf.page_merge_layers(1, "New Layer Name")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_merge_layers.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_annotations/_index.md b/chinese/rust-cpp/organize/page_remove_annotations/_index.md new file mode 100644 index 00000000000..33442320457 --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_annotations/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_annotations" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的注释。" +type: docs +url: /zh/rust-cpp/organize/page_remove_annotations/ +--- + +_删除页面中的注释._ + +```rust +pub fn page_remove_annotations(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的注释 + pdf.page_remove_annotations(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_annotations.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_hidden_text/_index.md b/chinese/rust-cpp/organize/page_remove_hidden_text/_index.md new file mode 100644 index 00000000000..17766764adf --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_hidden_text/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_hidden_text" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的隐藏文本。" +type: docs +url: /zh/rust-cpp/organize/page_remove_hidden_text/ +--- + +_删除页面中的隐藏文本._ + +```rust +pub fn page_remove_hidden_text(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的隐藏文本 + pdf.page_remove_hidden_text(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_hidden_text.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_images/_index.md b/chinese/rust-cpp/organize/page_remove_images/_index.md new file mode 100644 index 00000000000..35ccd39b96a --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_images/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_images" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的图像。" +type: docs +url: /zh/rust-cpp/organize/page_remove_images/ +--- + +_删除页面中的图像。_ + +```rust +pub fn page_remove_images(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的图像 + pdf.page_remove_images(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_images.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_tables/_index.md b/chinese/rust-cpp/organize/page_remove_tables/_index.md new file mode 100644 index 00000000000..3f8a5e7fcd5 --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_tables/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_tables" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的表格。" +type: docs +url: /zh/rust-cpp/organize/page_remove_tables/ +--- + +_删除页面中的表格。_ + +```rust +pub fn page_remove_tables(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的表格 + pdf.page_remove_tables(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_tables.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_text_footers/_index.md b/chinese/rust-cpp/organize/page_remove_text_footers/_index.md new file mode 100644 index 00000000000..6fa8e39e3d4 --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_text_footers/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_text_footers" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的文本页脚。" +type: docs +url: /zh/rust-cpp/organize/page_remove_text_footers/ +--- + +_删除页面中的文本页脚。_ + +```rust +pub fn page_remove_text_footers(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的文本页脚 + pdf.page_remove_text_footers(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_text_footers.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_text_headers/_index.md b/chinese/rust-cpp/organize/page_remove_text_headers/_index.md new file mode 100644 index 00000000000..9e49faa7a7e --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_text_headers/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_text_headers" +second_title: "Aspose.PDF for Rust via C++" +description: "在页面中移除文本页眉." +type: docs +url: /zh/rust-cpp/organize/page_remove_text_headers/ +--- + +_在页面中移除文本页眉._ + +```rust +pub fn page_remove_text_headers(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 在页面中移除文本页眉 + pdf.page_remove_text_headers(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_text_headers.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_remove_watermarks/_index.md b/chinese/rust-cpp/organize/page_remove_watermarks/_index.md new file mode 100644 index 00000000000..f662ce61b0b --- /dev/null +++ b/chinese/rust-cpp/organize/page_remove_watermarks/_index.md @@ -0,0 +1,40 @@ +--- +title: "page_remove_watermarks" +second_title: "Aspose.PDF for Rust via C++" +description: "删除页面中的水印。" +type: docs +url: /zh/rust-cpp/organize/page_remove_watermarks/ +--- + +_删除页面中的水印。_ + +```rust +pub fn page_remove_watermarks(&self, num: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 删除页面中的水印 + pdf.page_remove_watermarks(1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_remove_watermarks.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_replace_font/_index.md b/chinese/rust-cpp/organize/page_replace_font/_index.md new file mode 100644 index 00000000000..77ca0e2d1e4 --- /dev/null +++ b/chinese/rust-cpp/organize/page_replace_font/_index.md @@ -0,0 +1,42 @@ +--- +title: "page_replace_font" +second_title: "Aspose.PDF for Rust via C++" +description: "替换页面中的字体。" +type: docs +url: /zh/rust-cpp/organize/page_replace_font/ +--- + +_替换页面中的字体._ + +```rust +pub fn page_replace_font(&self, num: i32, find_font_name: &str, replace_font_name: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **find_font_name** - the font name to search + * **replace_font_name** - the font name to replace + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 替换页面中的字体 + pdf.page_replace_font(1, "Times-BoldItalic", "Helvetica-Bold")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_replace_font.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_replace_text/_index.md b/chinese/rust-cpp/organize/page_replace_text/_index.md new file mode 100644 index 00000000000..4d5c4d231c6 --- /dev/null +++ b/chinese/rust-cpp/organize/page_replace_text/_index.md @@ -0,0 +1,42 @@ +--- +title: "page_replace_text" +second_title: "Aspose.PDF for Rust via C++" +description: "替换页面上的文本。" +type: docs +url: /zh/rust-cpp/organize/page_replace_text/ +--- + +_替换页面上的文本。_ + +```rust +pub fn page_replace_text(&self, num: i32, find_text: &str, replace_text: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **find_text** - the text fragment to search + * **replace_text** - the text fragment to replace + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在页面上替换文本 + pdf.page_replace_text(1, "PDF", "TXT")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_replace_text.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_rotate/_index.md b/chinese/rust-cpp/organize/page_rotate/_index.md new file mode 100644 index 00000000000..f7aeab382a3 --- /dev/null +++ b/chinese/rust-cpp/organize/page_rotate/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_rotate" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF-document 中旋转页面." +type: docs +url: /zh/rust-cpp/organize/page_rotate/ +--- + +_在 PDF-document 中旋转页面._ + +```rust +pub fn page_rotate(&self, num: i32, rotation: Rotation) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **rotation** - rotation angle as enum `Rotation`: `None`, `On90`, `On180`, `On270`, or `On360` + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, Rotation}; + +fn main() -> Result<(), Box> { + // 从文件打开 PDF-document + let pdf = Document::open("sample.pdf")?; + + // 旋转页面 + pdf.page_rotate(1, Rotation::On180)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_rotate.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/page_set_size/_index.md b/chinese/rust-cpp/organize/page_set_size/_index.md new file mode 100644 index 00000000000..f7bc4b295a8 --- /dev/null +++ b/chinese/rust-cpp/organize/page_set_size/_index.md @@ -0,0 +1,41 @@ +--- +title: "page_set_size" +second_title: "Aspose.PDF for Rust via C++" +description: "设置 PDF 文档中页面的大小。" +type: docs +url: /zh/rust-cpp/organize/page_set_size/ +--- + +_设置 PDF 文档中页面的大小。_ + +```rust +pub fn page_set_size(&self, num: i32, page_size: PageSize) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **page_size** - page size as enum `PageSize`: `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, `B5`, `PageLetter`, `PageLegal`, `PageLedger`, or `P11x17` + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, PageSize}; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 设置 PDF 文档中页面的大小 + pdf.page_set_size(1, PageSize::A1)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_page1_set_size_A1.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_annotations/_index.md b/chinese/rust-cpp/organize/remove_annotations/_index.md new file mode 100644 index 00000000000..fb2822d1012 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_annotations/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_annotations" +second_title: "Aspose.PDF for Rust via C++" +description: "删除 PDF 文档中的批注。" +type: docs +url: /zh/rust-cpp/organize/remove_annotations/ +--- + +_删除 PDF 文档中的批注。_ + +```rust +pub fn remove_annotations(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的批注 + pdf.remove_annotations()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_annotations.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_attachments/_index.md b/chinese/rust-cpp/organize/remove_attachments/_index.md new file mode 100644 index 00000000000..2280fc9e8e3 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_attachments/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_attachments" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除附件。" +type: docs +url: /zh/rust-cpp/organize/remove_attachments/ +--- + +_从 PDF-document 中移除附件。_ + +```rust +pub fn remove_attachments(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的附件 + pdf.remove_attachments()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_attachments.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_blank_pages/_index.md b/chinese/rust-cpp/organize/remove_blank_pages/_index.md new file mode 100644 index 00000000000..14bd4a7bd48 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_blank_pages/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_blank_pages" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中删除空白页。" +type: docs +url: /zh/rust-cpp/organize/remove_blank_pages/ +--- + +_从 PDF-document 中删除空白页._ + +```rust +pub fn remove_blank_pages(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的空白页 + pdf.remove_blank_pages()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_blank_pages.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_bookmarks/_index.md b/chinese/rust-cpp/organize/remove_bookmarks/_index.md new file mode 100644 index 00000000000..9c04e43f5ee --- /dev/null +++ b/chinese/rust-cpp/organize/remove_bookmarks/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_bookmarks" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF 文档中移除书签。" +type: docs +url: /zh/rust-cpp/organize/remove_bookmarks/ +--- + +_从 PDF 文档中移除书签._ + +```rust +pub fn remove_bookmarks(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的书签 + pdf.remove_bookmarks()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_bookmarks.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_hidden_text/_index.md b/chinese/rust-cpp/organize/remove_hidden_text/_index.md new file mode 100644 index 00000000000..bee2d7762be --- /dev/null +++ b/chinese/rust-cpp/organize/remove_hidden_text/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_hidden_text" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除隐藏文本。" +type: docs +url: /zh/rust-cpp/organize/remove_hidden_text/ +--- + +_从 PDF-document 中移除隐藏文本。_ + +```rust +pub fn remove_hidden_text(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的隐藏文本 + pdf.remove_hidden_text()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_hidden_text.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_images/_index.md b/chinese/rust-cpp/organize/remove_images/_index.md new file mode 100644 index 00000000000..ca31dd4bfb0 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_images/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_images" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除图像。" +type: docs +url: /zh/rust-cpp/organize/remove_images/ +--- + +_从 PDF-document 中移除图像。_ + +```rust +pub fn remove_images(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的图像 + pdf.remove_images()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_images.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_javascripts/_index.md b/chinese/rust-cpp/organize/remove_javascripts/_index.md new file mode 100644 index 00000000000..4f1256cb3f3 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_javascripts/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_javascripts" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除 Java 脚本." +type: docs +url: /zh/rust-cpp/organize/remove_javascripts/ +--- + +_从 PDF-document 中移除 Java 脚本._ + +```rust +pub fn remove_javascripts(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 删除 PDF-文档 中的 Java 脚本 + pdf.remove_javascripts()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_javascripts.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_pdfa_compliance/_index.md b/chinese/rust-cpp/organize/remove_pdfa_compliance/_index.md new file mode 100644 index 00000000000..eb88d6bdb10 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_pdfa_compliance/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_pdfa_compliance" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除 PDF/A 合规性。" +type: docs +url: /zh/rust-cpp/organize/remove_pdfa_compliance/ +--- + +_删除 PDF/A 合规性从 PDF-document._ + +```rust +pub fn remove_pdfa_compliance(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从 PDF 文档中移除 PDF/A 合规性 + pdf.remove_pdfa_compliance()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_pdfa_compliance.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_pdfua_compliance/_index.md b/chinese/rust-cpp/organize/remove_pdfua_compliance/_index.md new file mode 100644 index 00000000000..ea92c144e83 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_pdfua_compliance/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_pdfua_compliance" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF 文档中移除 PDF/UA 合规性。" +type: docs +url: /zh/rust-cpp/organize/remove_pdfua_compliance/ +--- + +_从 PDF 文档中移除 PDF/UA 合规性。_ + +```rust +pub fn remove_pdfua_compliance(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从 PDF 文档中移除 PDF/UA 合规性 + pdf.remove_pdfua_compliance()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_pdfua_compliance.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_tables/_index.md b/chinese/rust-cpp/organize/remove_tables/_index.md new file mode 100644 index 00000000000..4698a5f44f4 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_tables/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_tables" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF 文档中移除表格。" +type: docs +url: /zh/rust-cpp/organize/remove_tables/ +--- + +_从 PDF 文档中移除表格._ + +```rust +pub fn remove_tables(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从 PDF 文档中移除表格 + pdf.remove_tables()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_tables.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_text_footers/_index.md b/chinese/rust-cpp/organize/remove_text_footers/_index.md new file mode 100644 index 00000000000..acd1034215b --- /dev/null +++ b/chinese/rust-cpp/organize/remove_text_footers/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_text_footers" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除文本页脚." +type: docs +url: /zh/rust-cpp/organize/remove_text_footers/ +--- + +_从 PDF-document 中移除文本页脚._ + +```rust +pub fn remove_text_footers(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 移除 PDF-document 中的文本页脚 + pdf.remove_text_footers()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_text_footers.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_text_headers/_index.md b/chinese/rust-cpp/organize/remove_text_headers/_index.md new file mode 100644 index 00000000000..df78cb957cf --- /dev/null +++ b/chinese/rust-cpp/organize/remove_text_headers/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_text_headers" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除文本标题。" +type: docs +url: /zh/rust-cpp/organize/remove_text_headers/ +--- + +_从 PDF-document 中移除文本标题。_ + +```rust +pub fn remove_text_headers(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从 PDF-document 中移除文本标题 + pdf.remove_text_headers()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_text_headers.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/remove_watermarks/_index.md b/chinese/rust-cpp/organize/remove_watermarks/_index.md new file mode 100644 index 00000000000..64b25a86e50 --- /dev/null +++ b/chinese/rust-cpp/organize/remove_watermarks/_index.md @@ -0,0 +1,40 @@ +--- +title: "remove_watermarks" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除水印。" +type: docs +url: /zh/rust-cpp/organize/remove_watermarks/ +--- + +_从 PDF-document 中移除水印。_ + +```rust +pub fn remove_watermarks(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 从 PDF-document 中移除水印 + pdf.remove_watermarks()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_remove_watermarks.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/repair/_index.md b/chinese/rust-cpp/organize/repair/_index.md new file mode 100644 index 00000000000..ee29798afe1 --- /dev/null +++ b/chinese/rust-cpp/organize/repair/_index.md @@ -0,0 +1,40 @@ +--- +title: "repair" +second_title: "Aspose.PDF for Rust via C++" +description: "修复 PDF 文档。" +type: docs +url: /zh/rust-cpp/organize/repair/ +--- + +_修复 PDF-document._ + +```rust +pub fn repair(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 修复 PDF-document + pdf.repair()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_repair.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/replace_font/_index.md b/chinese/rust-cpp/organize/replace_font/_index.md new file mode 100644 index 00000000000..b506a3f3354 --- /dev/null +++ b/chinese/rust-cpp/organize/replace_font/_index.md @@ -0,0 +1,41 @@ +--- +title: "replace_font" +second_title: "Aspose.PDF for Rust via C++" +description: "在 PDF-document 中替换字体。" +type: docs +url: /zh/rust-cpp/organize/replace_font/ +--- + +_在 PDF-document 中替换字体._ + +```rust +pub fn replace_font(&self, find_font_name: &str, replace_font_name: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **find_font_name** - the font name to search + * **replace_font_name** - the font name to replace + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 在 PDF 文档中替换字体。 + pdf.replace_font("Helvetica", "Courier")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_replace_font.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/replace_text/_index.md b/chinese/rust-cpp/organize/replace_text/_index.md new file mode 100644 index 00000000000..613f138f55a --- /dev/null +++ b/chinese/rust-cpp/organize/replace_text/_index.md @@ -0,0 +1,41 @@ +--- +title: "replace_text" +second_title: "Aspose.PDF for Rust via C++" +description: "替换文本。" +type: docs +url: /zh/rust-cpp/organize/replace_text/ +--- + +_替换文本。_ + +```rust +pub fn replace_text(&self, find_text: &str, replace_text: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **find_text** - the text fragment to search + * **replace_text** - the text fragment to replace + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 替换 PDF-文档 中的文本 + pdf.replace_text("PDF", "TXT")?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_replace_text.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/rotate/_index.md b/chinese/rust-cpp/organize/rotate/_index.md new file mode 100644 index 00000000000..4b8a06cc077 --- /dev/null +++ b/chinese/rust-cpp/organize/rotate/_index.md @@ -0,0 +1,40 @@ +--- +title: "rotate" +second_title: "Aspose.PDF for Rust via C++" +description: "旋转 PDF-document。" +type: docs +url: /zh/rust-cpp/organize/rotate/ +--- + +_旋转 PDF-document._ + +```rust +pub fn rotate(&self, rotation: Rotation) -> Result<(), PdfError> +``` + +**Arguments** + * **rotation** - rotation angle as enum `Rotation`: `None`, `On90`, `On180`, `On270`, or `On360` + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, Rotation}; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 旋转 PDF-document + pdf.rotate(Rotation::On270)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_rotate.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/set_background/_index.md b/chinese/rust-cpp/organize/set_background/_index.md new file mode 100644 index 00000000000..28db24716af --- /dev/null +++ b/chinese/rust-cpp/organize/set_background/_index.md @@ -0,0 +1,42 @@ +--- +title: "set_background" +second_title: "Aspose.PDF for Rust via C++" +description: "使用 RGB 值设置 PDF 文档的背景颜色。" +type: docs +url: /zh/rust-cpp/organize/set_background/ +--- + +_使用 RGB 值设置 PDF 文档的背景颜色。_ + +```rust +pub fn set_background(&self, r: i32, g: i32, b: i32) -> Result<(), PdfError> +``` + +**Arguments** + * **r** - red component (0-255) + * **g** - green component (0-255) + * **b** - blue component (0-255) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 使用 RGB 值设置 PDF 文档的背景颜色 + pdf.set_background(200, 100, 101)?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_set_background.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/unembed_fonts/_index.md b/chinese/rust-cpp/organize/unembed_fonts/_index.md new file mode 100644 index 00000000000..f8fa6106df0 --- /dev/null +++ b/chinese/rust-cpp/organize/unembed_fonts/_index.md @@ -0,0 +1,40 @@ +--- +title: "unembed_fonts" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中取消嵌入字体。" +type: docs +url: /zh/rust-cpp/organize/unembed_fonts/ +--- + +_从 PDF-document 中取消嵌入字体._ + +```rust +pub fn unembed_fonts(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 取消嵌入 PDF-document 的字体 + pdf.unembed_fonts()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_unembed_fonts.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/organize/validate/_index.md b/chinese/rust-cpp/organize/validate/_index.md new file mode 100644 index 00000000000..ca869577154 --- /dev/null +++ b/chinese/rust-cpp/organize/validate/_index.md @@ -0,0 +1,44 @@ +--- +title: "validate" +second_title: "Aspose.PDF for Rust via C++" +description: "验证 PDF 文档是否符合 PDF 格式规范。" +type: docs +url: /zh/rust-cpp/organize/validate/ +--- + +_验证 PDF 文档是否符合 PDF 格式规范。_ + +```rust + pub fn validate( + &self, + pdf_format: PdfFormat, + ) -> Result<(bool, String), PdfError> +``` + +**Arguments** + * **pdf_format** - the target PDF format standard (enum [PdfFormat](../../)) + +**Returns** + * **Ok((bool, String))** - the operation result, `String` contains the validation log + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, PdfFormat}; + +fn main() -> Result<(), Box> { + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 验证 PDF 文档是否符合 PDF 格式的规范 + let (ok, log) = pdf.validate(PdfFormat::PDF_A_2A)?; + + // 打印验证结果和完整日志 + println!("Validate PDF/A result: {}", ok); + println!("Validate PDF/A log:\n{}", log); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/_index.md b/chinese/rust-cpp/security/_index.md new file mode 100644 index 00000000000..9eea9b5d1a8 --- /dev/null +++ b/chinese/rust-cpp/security/_index.md @@ -0,0 +1,28 @@ +--- +title: "安全功能" +second_title: "Aspose.PDF for Rust via C++" +description: "安全功能。" +type: docs +url: /zh/rust-cpp/security/ +--- + +## Security + +| 函数 | 描述 | +| -------- | ----------- | +| [open_with_password](./open_with_password/) | 打开受密码保护的 PDF-document。 | +| [encrypt](./encrypt/) | 加密 PDF-document。 | +| [decrypt](./decrypt/) | 解密 PDF-document。 | +| [set_permissions](./set_permissions/) | 设置 PDF-document 的权限。 | +| [get_permissions](./get_permissions/) | 获取 PDF-document 的当前权限。 | +| [is_encrypted](./is_encrypted/) | 获取 PDF-document 的加密状态。 | +| [sign_pkcs7](./sign_pkcs7/) | 使用 PKCS#7 数字签名对 PDF-document 进行签名。 | +| [sign_pkcs7_detached](./sign_pkcs7_detached/) | 使用 PKCS#7 分离式数字签名对 PDF-document 进行签名。 | +| [is_signed](./is_signed/) | 获取 PDF-document 的签名状态。 | +| [remove_signs](./remove_signs/) | 从 PDF-document 中移除签名。 | + + +## Detailed Description + +安全功能。 + diff --git a/chinese/rust-cpp/security/decrypt/_index.md b/chinese/rust-cpp/security/decrypt/_index.md new file mode 100644 index 00000000000..ee8fda94be6 --- /dev/null +++ b/chinese/rust-cpp/security/decrypt/_index.md @@ -0,0 +1,40 @@ +--- +title: "解密" +second_title: "Aspose.PDF for Rust via C++" +description: "解密 PDF-document。" +type: docs +url: /zh/rust-cpp/security/decrypt/ +--- + +_解密 PDF 文档。_ + +```rust +pub fn decrypt(&self) -> Result<(), PdfError> +``` + +**Arguments** + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开受密码保护的 PDF 文档 + let pdf = Document::open_with_password("sample_with_password.pdf", "ownerpass")?; + + // 解密 PDF 文档 + pdf.decrypt()?; + + // 使用新文件名保存先前打开的 PDF 文档 + pdf.save_as("sample_decrypt.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/encrypt/_index.md b/chinese/rust-cpp/security/encrypt/_index.md new file mode 100644 index 00000000000..19334b92ed1 --- /dev/null +++ b/chinese/rust-cpp/security/encrypt/_index.md @@ -0,0 +1,57 @@ +--- +title: "加密" +second_title: "Aspose.PDF for Rust via C++" +description: "加密 PDF-document。" +type: docs +url: /zh/rust-cpp/security/encrypt/ +--- + +_加密 PDF 文档._ + +```rust +pub fn encrypt( + &self, + user_password: &str, + owner_password: &str, + permissions: Permissions, + crypto_algorithm: CryptoAlgorithm, + use_pdf_20: bool, +) -> Result<(), PdfError> +``` + +**Arguments** + * **user_password** - the user password + * **owner_password** - the owner password + * **permissions** - the allowed permissions (bitflags `Permissions`) + * **crypto_algorithm** - the encryption algorithm (`CryptoAlgorithm` enum) + * **use_pdf_20** - whether to use PDF 2.0 encryption + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{CryptoAlgorithm, Document, Permissions}; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 加密 PDF 文档 + pdf.encrypt( + "userpass", // User password + "ownerpass", // Owner password + Permissions::PRINT_DOCUMENT | Permissions::MODIFY_CONTENT | Permissions::FILL_FORM, // Permissions bitmask + CryptoAlgorithm::AESx128, // Encryption algorithm + true, // Use PDF 2.0 encryption + )?; + + // 保存已加密的 PDF 文档 + pdf.save_as("sample_with_password.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/get_permissions/_index.md b/chinese/rust-cpp/security/get_permissions/_index.md new file mode 100644 index 00000000000..261f51c8c9a --- /dev/null +++ b/chinese/rust-cpp/security/get_permissions/_index.md @@ -0,0 +1,40 @@ +--- +title: "get_permissions" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF-document 的当前权限。" +type: docs +url: /zh/rust-cpp/security/get_permissions/ +--- + +_获取 PDF 文档的当前权限。_ + +```rust +pub fn get_permissions(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(Permissions)** - the bitmask of permissions, if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, Permissions}; + +fn main() -> Result<(), Box> { + // 打开受密码保护的 PDF 文档 + let pdf = Document::open_with_password("sample_with_permissions.pdf", "ownerpass")?; + + // 获取 PDF 文档的当前权限 + let permissions: Permissions = pdf.get_permissions()?; + + // 打印权限 + println!("Permissions: {}", permissions); + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/is_encrypted/_index.md b/chinese/rust-cpp/security/is_encrypted/_index.md new file mode 100644 index 00000000000..700911de304 --- /dev/null +++ b/chinese/rust-cpp/security/is_encrypted/_index.md @@ -0,0 +1,39 @@ +--- +title: "is_encrypted" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF-document 的加密状态。" +type: docs +url: /zh/rust-cpp/security/is_encrypted/ +--- + +_获取 PDF 文档的加密状态。_ + +```rust +pub fn is_encrypted(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开受密码保护的 PDF 文档 + let pdf = Document::open_with_password("sample_with_password.pdf", "ownerpass")?; + + // 获取 PDF 文档的加密状态 + if pdf.is_encrypted()? { + println!("The document is encrypted."); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/is_signed/_index.md b/chinese/rust-cpp/security/is_signed/_index.md new file mode 100644 index 00000000000..91b7e8c8634 --- /dev/null +++ b/chinese/rust-cpp/security/is_signed/_index.md @@ -0,0 +1,39 @@ +--- +title: "is_signed" +second_title: "Aspose.PDF for Rust via C++" +description: "获取 PDF-document 的签名状态。" +type: docs +url: /zh/rust-cpp/security/is_signed/ +--- + +_获取 PDF 文档的签名状态._ + +```rust +pub fn is_signed(&self) -> Result +``` + +**Arguments** + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample_with_sign.pdf" 的 PDF 文档 + let pdf = Document::open("sample_with_sign.pdf")?; + + // 获取 PDF 文档的签名状态 + if pdf.is_signed()? { + println!("The document is signed."); + } + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/open_with_password/_index.md b/chinese/rust-cpp/security/open_with_password/_index.md new file mode 100644 index 00000000000..677712952f1 --- /dev/null +++ b/chinese/rust-cpp/security/open_with_password/_index.md @@ -0,0 +1,37 @@ +--- +title: "open_with_password" +second_title: "Aspose.PDF for Rust via C++" +description: "打开受密码保护的 PDF-document。" +type: docs +url: /zh/rust-cpp/security/open_with_password/ +--- + +_打开受密码保护的 PDF 文档。_ + +```rust +pub fn open_with_password(filename: &str, password: &str) -> Result +``` + +**Arguments** + * **filename** - path to the PDF-document to open + * **password** - user/owner password of the password-protected PDF-document + +**Returns** + * **Ok(Self)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开受密码保护的 PDF 文档 + let _pdf = Document::open_with_password("sample_with_password.pdf", "ownerpass")?; + + // 处理中... + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/remove_signs/_index.md b/chinese/rust-cpp/security/remove_signs/_index.md new file mode 100644 index 00000000000..8880faa76b8 --- /dev/null +++ b/chinese/rust-cpp/security/remove_signs/_index.md @@ -0,0 +1,38 @@ +--- +title: "remove_signs" +second_title: "Aspose.PDF for Rust via C++" +description: "从 PDF-document 中移除签名。" +type: docs +url: /zh/rust-cpp/security/remove_signs/ +--- + +_从 PDF 文档中移除签名。_ + +```rust +pub fn remove_signs(&self, filename: &str) -> Result<(), PdfError> +``` + +**Arguments** + * **filename** - the path to the resulting PDF-document without signatures + + +**Returns** + * **Ok(bool)** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; + +fn main() -> Result<(), Box> { + // 打开名为 "sample_with_sign.pdf" 的 PDF 文档 + let pdf = Document::open("sample_with_sign.pdf")?; + + // 从 PDF 文档中移除签名 + pdf.remove_signs("sample_remove_signs.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/set_permissions/_index.md b/chinese/rust-cpp/security/set_permissions/_index.md new file mode 100644 index 00000000000..60b25f9bfa2 --- /dev/null +++ b/chinese/rust-cpp/security/set_permissions/_index.md @@ -0,0 +1,51 @@ +--- +title: "set_permissions" +second_title: "Aspose.PDF for Rust via C++" +description: "设置 PDF-document 的权限。" +type: docs +url: /zh/rust-cpp/security/set_permissions/ +--- + +_设置 PDF 文档的权限._ + +```rust +pub fn set_permissions( + &self, + user_password: &str, + owner_password: &str, + permissions: Permissions, +) -> Result<(), PdfError> +``` + +**Arguments** + * **user_password** - the user password + * **owner_password** - the owner password + * **permissions** - the allowed permissions (bitflags `Permissions`) + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::{Document, Permissions}; + +fn main() -> Result<(), Box> { + // 创建一个新的 PDF-document + let pdf = Document::new()?; + + // 设置 PDF-document 的权限。 + pdf.set_permissions( + "userpass", // User password + "ownerpass", // Owner password + Permissions::PRINT_DOCUMENT | Permissions::MODIFY_CONTENT | Permissions::FILL_FORM, // Permissions bitmask + )?; + + // 保存已更新权限的 PDF 文档 + pdf.save_as("sample_with_permissions.pdf")?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/sign_pkcs7/_index.md b/chinese/rust-cpp/security/sign_pkcs7/_index.md new file mode 100644 index 00000000000..a9c35280aa1 --- /dev/null +++ b/chinese/rust-cpp/security/sign_pkcs7/_index.md @@ -0,0 +1,84 @@ +--- +title: "sign_pkcs7" +second_title: "Aspose.PDF for Rust via C++" +description: "使用 PKCS#7 数字签名对 PDF-document 进行签名。" +type: docs +url: /zh/rust-cpp/security/sign_pkcs7/ +--- + +_使用 PKCS#7 数字签名对 PDF 文档进行签名._ + +```rust + pub fn sign_pkcs7( + &self, + num: i32, + sign_data: &[u8], + psw_sign: &str, + set_x_indent: i32, + set_y_indent: i32, + set_height: i32, + set_width: i32, + reason: &str, + contact: &str, + location: &str, + is_visible: bool, + appearance_data: &[u8], + filename: &str, + ) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **sign_data** - the raw bytes of the signature (PKCS#7 specification in Internet RFC 2315) + * **psw_sign** - the password of the signature + * **set_x_indent** - the x indent of the signature + * **set_y_indent** - the y indent of the signature + * **set_height** - the height of the signature + * **set_width** - the width of the signature + * **reason** - the reason of a signature + * **contact** - the contact of a signature + * **location** - the location of a signature + * **is_visible** - the visiblity of signature + * **appearance_data** - the raw bytes of the graphic appearance for the signature + * **filename** - the path to the resulting PDF-document with signature + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; +use std::fs; + +fn main() -> Result<(), Box> { + // 将证书和图像文件读取为字节向量 + let cert = fs::read("sign.pfx")?; + let img = fs::read("sign.png")?; + + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 使用 PKCS#7 数字签名对 PDF 文档进行签名 + pdf.sign_pkcs7( + 1, + &cert, + "Pa$$w0rd2023", + 100, + 100, + 70, + 100, + "Reason", + "Contact", + "Location", + true, + &img, + "sample_sign_pkcs7.pdf", + )?; + + Ok(()) +} + +``` \ No newline at end of file diff --git a/chinese/rust-cpp/security/sign_pkcs7_detached/_index.md b/chinese/rust-cpp/security/sign_pkcs7_detached/_index.md new file mode 100644 index 00000000000..4f8c71ba628 --- /dev/null +++ b/chinese/rust-cpp/security/sign_pkcs7_detached/_index.md @@ -0,0 +1,84 @@ +--- +title: "sign_pkcs7_detached" +second_title: "Aspose.PDF for Rust via C++" +description: "使用 PKCS#7 分离式数字签名对 PDF-document 进行签名。" +type: docs +url: /zh/rust-cpp/security/sign_pkcs7_detached/ +--- + +_使用 PKCS#7 分离式数字签名对 PDF 文档进行签名._ + +```rust + pub fn sign_pkcs7_detached( + &self, + num: i32, + sign_data: &[u8], + psw_sign: &str, + set_x_indent: i32, + set_y_indent: i32, + set_height: i32, + set_width: i32, + reason: &str, + contact: &str, + location: &str, + is_visible: bool, + appearance_data: &[u8], + filename: &str, + ) -> Result<(), PdfError> +``` + +**Arguments** + * **num** - the page number (1-based) + * **sign_data** - the raw bytes of the signature (PKCS#7 specification in Internet RFC 2315) + * **psw_sign** - the password of the signature + * **set_x_indent** - the x indent of the signature + * **set_y_indent** - the y indent of the signature + * **set_height** - the height of the signature + * **set_width** - the width of the signature + * **reason** - the reason of a signature + * **contact** - the contact of a signature + * **location** - the location of a signature + * **is_visible** - the visiblity of signature + * **appearance_data** - the raw bytes of the graphic appearance for the signature + * **filename** - the path to the resulting PDF-document with signature + + +**Returns** + * **Ok(())** - if the operation succeeds + * **Err(PdfError)** - if the operation fails + +**Example** + +```rust +use asposepdf::Document; +use std::fs; + +fn main() -> Result<(), Box> { + // 将证书和图像文件读取为字节向量 + let cert = fs::read("sign.pfx")?; + let img = fs::read("sign.png")?; + + // 打开具有文件名的 PDF 文档 + let pdf = Document::open("sample.pdf")?; + + // 使用 PKCS#7 分离式数字签名对 PDF 文档进行签名 + pdf.sign_pkcs7_detached( + 1, + &cert, + "Pa$$w0rd2023", + 100, + 100, + 70, + 100, + "Reason", + "Contact", + "Location", + true, + &img, + "sample_sign_pkcs7_detached.pdf", + )?; + + Ok(()) +} + +``` \ No newline at end of file