diff --git a/.codex/SKILLS.md b/.codex/SKILLS.md
new file mode 100644
index 0000000..254b377
--- /dev/null
+++ b/.codex/SKILLS.md
@@ -0,0 +1,40 @@
+# Local Codex Skills
+
+This repository now uses small, task-focused skills instead of one monolithic skill document.
+
+## Skills
+
+- `pdf-operations`
+ - Purpose: Aspose.PDF operation patterns, API hints, and example behavior rules.
+ - File: `.codex/skills/pdf-operations/SKILL.md`
+- `code-style`
+ - Purpose: Shared formatting, file layout, naming, path, and error-handling conventions.
+ - File: `.codex/skills/code-style/SKILL.md`
+- `spec-generator`
+ - Purpose: Generate or refresh machine-readable example specs and scaffold new example files.
+ - File: `.codex/skills/spec-generator/SKILL.md`
+
+## Suggested Combinations
+
+- New example implementation:
+ - `pdf-operations` + `code-style`
+- Refactor or normalize an existing example:
+ - `pdf-operations` + `code-style`
+- Refresh generated repository metadata/specs:
+ - `spec-generator`
+- Add a new example and keep generated specs in sync:
+ - `pdf-operations` + `code-style` + `spec-generator`
+
+## Scripts
+
+- `python scripts/generate_example_specs.py`
+ - Scans `examples/` and refreshes generated spec artifacts under `specs/examples/`
+- `python scripts/generate_example_stub.py --category --name --operation `
+ - Scaffolds a new example file using the repo's standard template
+
+## Generated Artifacts
+
+- `specs/examples/index.json`
+- `specs/examples/index.md`
+
+Treat those files as generated outputs. Re-run the generator after adding or materially changing example modules.
diff --git a/.codex/config.yaml b/.codex/config.yaml
new file mode 100644
index 0000000..9e085c7
--- /dev/null
+++ b/.codex/config.yaml
@@ -0,0 +1,29 @@
+# ~/.codex/config.yaml
+
+# --- Core Codex Settings ---
+model: gpt-5.3
+approval_mode: auto-edit
+notify: true
+
+# --- Execution Behavior ---
+fullAutoErrorMode: ask-user # ask-user | ignore-and-continue
+
+# --- Project Instructions ---
+instructions: |
+ You are working in a repository of Python examples for Aspose.PDF for Python via .NET.
+
+ Prefer the narrowest applicable local skill from `.codex/skills/`:
+ - `pdf-operations` for Aspose.PDF API usage and example behavior
+ - `code-style` for structure, naming, path handling, and output conventions
+ - `spec-generator` for generating or refreshing repository example specs
+
+ Global repository rules:
+ - Preserve the established example architecture under `examples/`
+ - Reuse `examples/config.py` for `set_license(...)` and `initialize_data_dir(...)`
+ - Do not add new dependencies beyond the repo's current Python requirements unless explicitly requested
+ - Prefer repo-owned automation in `scripts/` over ad-hoc one-off generation logic
+ - When examples are added or materially changed, refresh the generated spec artifacts with:
+ `python scripts/generate_example_specs.py`
+ - When scaffolding a new example, prefer:
+ `python scripts/generate_example_stub.py --category --name --operation `
+ - Keep generated artifacts deterministic and safe to re-run
diff --git a/.codex/skills/code-style/SKILL.md b/.codex/skills/code-style/SKILL.md
new file mode 100644
index 0000000..499d204
--- /dev/null
+++ b/.codex/skills/code-style/SKILL.md
@@ -0,0 +1,69 @@
+---
+name: code-style
+description: Apply shared repository style rules for Aspose.PDF Python example files, including structure, naming, path handling, docstrings, status output, and error handling.
+metadata:
+ short-description: Shared style rules for example scripts
+ version: "1.0"
+---
+
+# Code Style
+
+## Use This Skill When
+
+- Creating or refactoring repository example scripts
+- Normalizing older examples to the current house style
+- Reviewing whether generated code matches repository conventions
+
+## Structure Rules
+
+- Keep the import block simple and consistent
+- Always use:
+ - `from os import path`
+ - `sys.path.append(path.join(path.dirname(__file__), '..'))`
+- Use following snippet in `facades` subfolder examples:
+ ```python
+ from os import path
+ import sys
+
+ CURRENT_DIR = path.dirname(__file__)
+ EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+ if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+ ```
+- Import shared helpers from `examples/config.py`
+- Preserve `run_all_examples()` as the entrypoint
+
+## Function Rules
+
+- Operation functions must accept file paths as `str`
+- Do not pass `Document` objects between functions
+- Use descriptive names tied to the actual action
+- Keep one function responsible for one operation
+
+## Path Rules
+
+- Use `path.join(...)` for repository-local paths
+- Do not hardcode absolute paths
+- Use `initialize_data_dir(...)` instead of hand-rolling sample-data locations
+
+## Error Handling And Output
+
+- Wrap each example run in `try/except`
+- Do not stop the full example run because one case failed
+- Preserve the repository's success/failure markers:
+ - `✅ Success`
+ - `❌ Failed`
+
+## Documentation
+
+- Add or preserve concise docstrings on public example functions
+- Prefer docstrings with `Args` and `Returns` when the function is non-trivial
+- Keep comments brief and useful
+
+## Anti-Patterns
+
+- Hardcoded file system paths
+- Breaking `run_all_examples()`
+- Removing status prints
+- Adding dependencies not already used by the repo
+- Large architectural rewrites for narrow example changes
diff --git a/.codex/skills/pdf-operations/SKILL.md b/.codex/skills/pdf-operations/SKILL.md
new file mode 100644
index 0000000..88bf2a7
--- /dev/null
+++ b/.codex/skills/pdf-operations/SKILL.md
@@ -0,0 +1,194 @@
+---
+name: pdf-operations
+description: Implement or update Aspose.PDF for Python via .NET example logic, including opening, saving, merging, splitting, protecting, converting, and related document operations.
+metadata:
+ short-description: Aspose.PDF example operation guidance
+ version: "1.0"
+---
+
+# PDF Operations
+
+## Use This Skill When
+
+- Creating a new example script for a PDF feature
+- Updating example logic that touches Aspose.PDF APIs
+- Translating a request like merge, split, encrypt, convert, annotate, extract, or optimize into repository code
+
+## Required Behavior
+
+- Operate on file paths, not shared `Document` objects passed between functions
+- Keep one public operation function focused on one concrete behavior
+- Preserve `run_all_examples()` as the execution entrypoint
+- Keep examples runnable in evaluation mode when no license is supplied
+
+## Standard Structure
+
+Every example should align with this flow:
+
+1. Import `aspose.pdf as ap`
+2. Append the parent examples directory with:
+ `sys.path.append(path.join(path.dirname(__file__), '..'))`
+3. Import `set_license` and `initialize_data_dir` from `config`
+4. Implement one or more operation functions accepting string paths
+5. Implement `run_all_examples(data_dir=None, license_path=None)`
+6. Call `set_license(...)` and `initialize_data_dir(...)`
+7. Execute examples with per-example `try/except`
+
+For nested example folders, adjust the shared-config import path to match the real directory depth. For example, files under `examples/facades/pdf_content_editor/` can use:
+
+```python
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+```
+
+## API Reference
+
+- Open document:
+ - `ap.Document(path)`
+ - `ap.Document(path, password)`
+- Save document:
+ - `document.save(path)`
+- Merge:
+ - `doc1.pages.add(doc2.pages)`
+- Encrypt:
+ - `document.encrypt(user_pwd, owner_pwd, privileges, algorithm, False)`
+- Convert:
+ - `document.convert(log_path, ap.PdfFormat.PDF_X_3, ap.ConvertErrorAction.DELETE)`
+
+## Facades
+
+Use facade APIs when the repository already demonstrates a task through `aspose.pdf.facades` rather than the core `Document` API. In these examples, the operation function should still accept file paths, but the implementation can create and bind a facade object internally.
+
+### Shared Facade Pattern
+
+For content-editor style examples:
+
+```python
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+
+def operation_name(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ # perform facade operation
+ content_editor.save(outfile)
+```
+
+### Facade Rules
+
+- Keep facade object creation inside the operation function
+- Bind with `bind_pdf(infile)` before mutating content
+- Save with the facade object after the operation is complete
+- Use `aspose.pydrawing` geometry and colors when the facade API requires rectangles or color values
+- Preserve one function per concrete operation even when multiple operations share the same facade class
+
+### PdfContentEditor Examples
+
+Text annotation:
+
+```python
+def add_text_annotation(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ content_editor.create_text(
+ apd.Rectangle(100, 400, 50, 50),
+ "Text Annotation",
+ "This is a text annotation",
+ True,
+ "Insert",
+ 1,
+ )
+ content_editor.save(outfile)
+```
+
+Free text annotation:
+
+```python
+def add_free_text_annotation(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ content_editor.create_free_text(
+ apd.Rectangle(200, 480, 150, 25),
+ "This is a free text annotation",
+ 1,
+ )
+ content_editor.save(outfile)
+```
+
+Caret annotation:
+
+```python
+def add_caret_annotation(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ content_editor.create_caret(
+ 1,
+ apd.Rectangle(350, 400, 10, 10),
+ apd.Rectangle(300, 380, 115, 15),
+ "P",
+ "This is a caret annotation",
+ apd.Color.red,
+ )
+ content_editor.save(outfile)
+```
+
+Markup annotation variants:
+
+```python
+def add_markup_annotation(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ content_editor.create_markup(
+ apd.Rectangle(120, 440, 200, 20),
+ "This is a highlight annotation",
+ 0,
+ 1,
+ apd.Color.yellow,
+ )
+ content_editor.create_markup(
+ apd.Rectangle(110, 542, 200, 20),
+ "This is a underline annotation",
+ 1,
+ 1,
+ apd.Color.yellow,
+ )
+ content_editor.save(outfile)
+```
+
+Popup annotation:
+
+```python
+def add_popup_annotation(infile, outfile):
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(infile)
+ content_editor.create_popup(
+ apd.Rectangle(220, 520, 180, 80),
+ "This is a popup annotation",
+ True,
+ 1,
+ )
+ content_editor.save(outfile)
+```
+
+### When To Prefer Facades
+
+- The existing repo examples for that feature already use `aspose.pdf.facades`
+- The API is centered on editor-style helpers such as content editing, file security, file info, or signatures
+- The operation is naturally modeled as bind -> mutate -> save rather than load `Document` -> traverse object model -> save
+
+## Repository Constraints
+
+- Python 3.7+ source style
+- Allowed dependencies are limited to the repo requirements
+- Do not introduce a test framework just for examples
+- Do not redesign folder structure when a focused example change will do
+
+## Output Expectations
+
+- Generated output names should remain descriptive and stable
+- Prefer `{function_name}_out.pdf` when producing a single canonical PDF output
+- Status lines should remain easy to scan from the console
diff --git a/.codex/skills/spec-generator/SKILL.md b/.codex/skills/spec-generator/SKILL.md
new file mode 100644
index 0000000..39efbfb
--- /dev/null
+++ b/.codex/skills/spec-generator/SKILL.md
@@ -0,0 +1,44 @@
+---
+name: spec-generator
+description: Generate and maintain repository example specs and example scaffolding artifacts for Aspose.PDF for Python via .NET.
+metadata:
+ short-description: Example spec generation workflow
+ version: "1.0"
+---
+
+# Spec Generator
+
+## Use This Skill When
+
+- Refreshing machine-readable metadata for the example catalog
+- Generating repo documentation from the current `examples/` tree
+- Scaffolding a new example file with the standard repository template
+- Keeping Codex-facing specs aligned with the actual source tree
+
+## Pipeline Entry Points
+
+- Refresh generated specs:
+ - `python scripts/generate_example_specs.py`
+- Scaffold a new example:
+ - `python scripts/generate_example_stub.py --category --name --operation `
+
+## Generated Outputs
+
+- `specs/examples/index.json`
+- `specs/examples/index.md`
+
+These artifacts should be deterministic so they can be regenerated after source changes.
+
+## Generator Expectations
+
+- Scan `examples/` recursively
+- Ignore generated caches and `examples/config.py`
+- Extract stable metadata from Python source
+- Preserve sorted output for low-noise diffs
+- Fail loudly on invalid Python modules instead of silently producing partial garbage
+
+## Integration Rules
+
+- After adding or materially changing an example module, refresh specs before closing the task
+- Prefer updating generator scripts instead of hand-editing generated spec artifacts
+- Keep scaffolded examples aligned with the `pdf-operations` and `code-style` skills
diff --git a/.gitignore b/.gitignore
index dc345d3..c6a95a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -250,3 +250,4 @@ BundleArtifacts/
.cake/*
.nugetapikey
+.vscode
diff --git a/README.md b/README.md
index e12a1bd..5ce42ff 100644
--- a/README.md
+++ b/README.md
@@ -12,13 +12,13 @@ Directory | Description
-
+
## General PDF Features
- Supports most established PDF standards and PDF specifications.
-- Ability to read & export PDFs in multiple image formats including BMP, GIF, JPEG & PNG.
+- Ability to read & export PDFs in multiple image formats including BMP, GIF, JPEG & PNG.
- Set basic information (e.g. author, creator) of the PDF document.
- Configure PDF Page properties (e.g. width, height, cropbox, bleedbox etc.).
- Set page numbering, bookmark level, page sizes etc.
@@ -75,7 +75,7 @@ Below code snippet follows these steps:
1. Create an instance of the HtmlLoadOptions object.
1. Initialize Document object.
-1. Save output PDF document by calling Document.Save() method.
+1. Save output PDF document by calling Document.save() method.
```python
import aspose.pdf as ap
diff --git a/examples/facades/form/exporting_pdf_form_data.py b/examples/facades/form/exporting_pdf_form_data.py
new file mode 100644
index 0000000..e141c7b
--- /dev/null
+++ b/examples/facades/form/exporting_pdf_form_data.py
@@ -0,0 +1,121 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Export Data to XML
+def export_pdf_form_data_to_xml(infile, datafile):
+ """Export PDF form data to XML file."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Open XML file as stream
+ with FileIO(datafile, 'w') as xml_output_stream:
+ # Export data from PDF form fields to XML
+ pdf_form.export_xml(xml_output_stream)
+
+# Export Data to FDF
+def export_form_data_to_fdf(infile, outfile):
+ """Export PDF form data to FDF file."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Create FDF file stream
+ with open(outfile, 'wb') as fdf_output_stream:
+ # Export form data to FDF file
+ pdf_form.export_fdf(fdf_output_stream)
+
+# Export Data to XFDF
+def export_pdf_form_to_xfdf(infile, outfile):
+ """Export PDF form data to XFDF file."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Create XFDF file stream
+ with open(outfile, "wb") as xfdf_output_stream:
+ # Export form data to XFDF file
+ pdf_form.export_xfdf(xfdf_output_stream)
+
+# Export Data to JSON
+def export_form_to_json(infile, outfile):
+ """Export PDF form field values to JSON file."""
+ # Create Form object
+ form = pdf_facades.Form()
+
+ # Bind PDF document
+ form.bind_pdf(infile)
+
+ # Create JSON file stream
+ with FileIO(outfile, 'w') as json_stream:
+ # Export form field values to JSON
+ form.export_json(json_stream, indented=True)
+
+# Extract XFA Data
+def export_xfa_data(infile, outfile):
+ """Export XFA form data."""
+ # Create Form object
+ form = pdf_facades.Form()
+
+ # Bind PDF document
+ form.bind_pdf(infile)
+
+ with FileIO(outfile, 'w') as stream:
+ # Export form field values to JSON
+ form.extract_xfa_data(stream)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import/export form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Export Data to XML", export_pdf_form_data_to_xml, "sample_form.xml"),
+ ("Export Data to FDF", export_form_data_to_fdf, "sample_form.fdf"),
+ ("Export Data to XFDF", export_pdf_form_to_xfdf, "sample_form.xfdf"),
+ ("Export Values to JSON", export_form_to_json, "sample_form.json"),
+ ("Export XFA Data", export_xfa_data, "sample_form_xfa.xml"),
+ ]
+
+ for name, func, data_file_name in examples:
+ try:
+ if (func.__name__ == "export_xfa_data"):
+ input_file_name = path.join(input_dir, "sample_xfa_form.pdf")
+ else:
+ input_file_name = path.join(input_dir, "sample_form.pdf")
+ output_file_name = path.join(output_dir, data_file_name)
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll Export Form Data examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/form/filling_form_fields.py b/examples/facades/form/filling_form_fields.py
new file mode 100644
index 0000000..1f72642
--- /dev/null
+++ b/examples/facades/form/filling_form_fields.py
@@ -0,0 +1,154 @@
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Fill Text Fields
+def fill_text_fields(infile, outfile):
+ """Fill text fields in PDF form."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill text fields by name
+ pdf_form.fill_field("name", "John Doe")
+ pdf_form.fill_field("address", "123 Main St, Anytown, USA")
+ pdf_form.fill_field("email", "john.doe@example.com")
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Fill Check Box Fields
+def fill_check_box_fields(infile, outfile):
+ """Fill check box fields in PDF form."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill check box fields by name
+ pdf_form.fill_field("subscribe_newsletter", "Yes")
+ pdf_form.fill_field("accept_terms", "Yes")
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Fill Radio Button Fields
+def fill_radio_button_fields(infile, outfile):
+ """Fill radio button fields in PDF form."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill radio button fields by name
+ pdf_form.fill_field("gender", 0) # Select male option (index 0)
+ #pdf_form.fill_field("gender", 1) # Select female option (index 1)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Fill List Box / Multi-Select Fields
+def fill_list_box_fields(infile, outfile):
+ """Fill list box and multi-select fields in PDF form."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill list box / multi-select fields by name
+ pdf_form.fill_field("favorite_colors", "Red")
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Fill Barcode Fields
+def fill_barcode_fields(infile, outfile):
+ """Fill barcode fields in PDF form."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill barcode fields by name
+ pdf_form.fill_field("product_barcode", "123456789012")
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Fill Fields by Name and Value
+def fill_fields_by_name_and_value(infile, outfile):
+ """Fill PDF form fields by name and value."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Fill fields by name and value
+ fields = {
+ "name": "Jane Smith",
+ "address": "456 Elm St, Othertown, USA",
+ "email": "jane.smith@example.com"
+ }
+
+ names = list(fields.keys())
+ values = list(fields.values())
+ output = []
+ pdf_form.fill_fields(names, values, output)
+ stream = output[0] # Get filled PDF as stream
+ stream.seek(0) # Reset stream position to beginning
+ with open(outfile, 'wb') as f:
+ f.write(stream.read())
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Fill Text Fields", fill_text_fields),
+ ("Fill Check Box Fields", fill_check_box_fields),
+ ("Fill Radio Button Fields", fill_radio_button_fields),
+ ("Fill List Box / Multi-Select Fields", fill_list_box_fields),
+ ("Fill Barcode Fields", fill_barcode_fields),
+ ("Fill Fields by Name and Value", fill_fields_by_name_and_value)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, f"{func.__name__}_in.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll Fill Form Fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/form/importing_pdf_form_data.py b/examples/facades/form/importing_pdf_form_data.py
new file mode 100644
index 0000000..3099680
--- /dev/null
+++ b/examples/facades/form/importing_pdf_form_data.py
@@ -0,0 +1,139 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Import data from XML
+def import_xml_to_pdf_fields(infile, datafile, outfile):
+ """Import form data from XML file into PDF form fields."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Open XML file as stream
+ with FileIO(datafile, 'r') as xml_input_stream:
+ # Import data from XML into PDF form fields
+ pdf_form.import_xml(xml_input_stream)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Import Data from FDF
+def import_fdf_to_pdf_form(infile, datafile, outfile):
+ """Import form data from FDF file into PDF form fields."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Open FDF file as stream
+ with open(datafile, 'rb') as fdf_input_stream:
+ pdf_form.import_fdf(fdf_input_stream)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Import Data from XFDF
+def import_data_from_xfdf(infile, datafile, outfile):
+ """Import form data from XFDF file into PDF form fields."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Open XFDF file as stream
+ with open(datafile, 'rb') as xfdf_input_stream:
+ # Import data from XFDF into PDF form fields
+ pdf_form.import_xfdf(xfdf_input_stream)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Import from JSON
+def import_json_to_pdf_form(infile, datafile, outfile):
+ """Import form data from JSON file into PDF form fields."""
+ # Create Form object
+ form = pdf_facades.Form()
+
+ # Bind PDF document
+ form.bind_pdf(infile)
+
+ # Open JSON file as stream
+ with FileIO(datafile, 'r') as json_stream:
+ # Import data from JSON into PDF form fields
+ form.import_json(json_stream)
+
+ # Save updated PDF
+ form.save(outfile)
+
+# Replace from XFA data
+def replace_xfa_data(infile, datafile, outfile):
+ """Import form data from XFA file into PDF form fields."""
+ # Create Form object
+ form = pdf_facades.Form()
+
+ # Bind PDF document
+ form.bind_pdf(infile)
+
+ # Open XFA file as stream
+ with FileIO(datafile, 'r') as xfa_stream:
+ # Import data from XFA into PDF form fields
+ form.set_xfa_data(xfa_stream)
+
+ # Save updated PDF
+ form.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Import Data from XML", import_xml_to_pdf_fields, "sample_form.xml"),
+ ("Import Data from FDF", import_fdf_to_pdf_form, "sample_form.fdf"),
+ ("Import Data from XFDF", import_data_from_xfdf, "sample_form.xfdf"),
+ ("Import Values from JSON", import_json_to_pdf_form, "sample_form.json"),
+ ("Replace XFA Data", replace_xfa_data, "sample_form_xfa.xml"),
+ ]
+
+ for name, func, data_file_name in examples:
+ try:
+ if (func.__name__ == "replace_xfa_data"):
+ input_file_name = path.join(input_dir, "sample_xfa_form.pdf")
+ else:
+ input_file_name = path.join(input_dir, "sample_form_new.pdf")
+ form_data_file_name = path.join(input_dir, data_file_name)
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, form_data_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll Import Form Data examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/form/managing-pdf-form-fields.py b/examples/facades/form/managing-pdf-form-fields.py
new file mode 100644
index 0000000..25eed89
--- /dev/null
+++ b/examples/facades/form/managing-pdf-form-fields.py
@@ -0,0 +1,98 @@
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Flatten specific fields
+def flatten_specific_fields(infile, outfile):
+ """Flatten specific fields in a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Flatten specific fields by their names
+ fields_to_flatten = ["First Name", "Last Name"]
+ for field_name in fields_to_flatten:
+ pdf_form.flatten_field(field_name)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Flatten all fields
+def flatten_all_fields(infile, outfile):
+ """Flatten all fields in a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Flatten all fields in the PDF document
+ pdf_form.flatten_all_fields()
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+# Rename form fields
+def rename_form_fields(infile, outfile):
+ """Rename form fields in a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Rename form fields by providing a mapping of old names to new names
+ field_renaming_map = [
+ ("First Name", "NewFirstName"),
+ ("Last Name", "NewLastName")
+ ]
+ for old_name, new_name in field_renaming_map:
+ pdf_form.rename_field(old_name, new_name)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Flatten Specific Fields", flatten_specific_fields),
+ ("Flatten All Fields", flatten_all_fields),
+ ("Rename Form Fields", rename_form_fields)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample_form.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll managing PDF form fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/form/reading-and-inspecting-form-data.py b/examples/facades/form/reading-and-inspecting-form-data.py
new file mode 100644
index 0000000..8778f9e
--- /dev/null
+++ b/examples/facades/form/reading-and-inspecting-form-data.py
@@ -0,0 +1,142 @@
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+# Get field values
+def get_field_values(infile):
+ """Get field values from a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Get field values by their names
+ field_names = ["First Name", "Last Name"]
+ for field_name in field_names:
+ value = pdf_form.get_field(field_name)
+ print(f"Value of '{field_name}': {value}")
+
+
+# Get rich text values
+def get_rich_text_values(infile):
+ """Get rich text values from a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Get rich text values by their names
+ field_names = ["Summary"]
+ for field_name in field_names:
+ rich_text_value = pdf_form.get_rich_text(field_name)
+ print(f"Rich text value of '{field_name}': {rich_text_value}")
+
+
+# Get radio button options
+def get_radio_button_options(infile):
+ """Get radio button options from a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Get radio button options by their names
+ field_names = ["WorkType"]
+ for field_name in field_names:
+ options = pdf_form.get_button_option_current_value(field_name)
+ print(f"Options for '{field_name}': {options}")
+
+
+# Resolve full field names
+def resolve_full_field_names(infile):
+ """Resolve full field names in a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Resolve full field names
+ for field in pdf_form.field_names:
+ name= pdf_form.get_full_field_name(field)
+ print(f"Full field name: {name}")
+
+# Get required field names
+def get_required_field_names(infile):
+ """Get required field names from a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Get required field names
+ for field in pdf_form.field_names:
+ if pdf_form.is_required_field(field):
+ print(f"Required field: {field}")
+
+#get field facades
+def get_field_facades(infile):
+ """Get field facades from a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Get field facades
+ for field in pdf_form.field_names:
+ facade = pdf_form.get_field_facade(field)
+ print(f"Field facade for '{field}': {facade.box.location}, {facade.box.size}")
+ print(f"Field facade for '{field}': {facade.font.name}, {facade.font_size}")
+
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, _ = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get Field Values", get_field_values),
+ ("Get Rich Text Values", get_rich_text_values),
+ ("Get Radio Button Options", get_radio_button_options),
+ ("Resolve Full Field Names", resolve_full_field_names),
+ ("Get Required Field Names", get_required_field_names),
+ ("Get Field Facades", get_field_facades)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, f"{func.__name__}_in.pdf")
+ func(input_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll managing PDF form fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/form/working_with_button_fields.py b/examples/facades/form/working_with_button_fields.py
new file mode 100644
index 0000000..9544532
--- /dev/null
+++ b/examples/facades/form/working_with_button_fields.py
@@ -0,0 +1,72 @@
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Add image appearance to button fields
+def add_image_appearance_to_button_fields(infile, outfile):
+ """Add image appearance to button fields in a PDF document."""
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+
+ # Add image appearance to button fields by providing the field name and image stream
+ image_path = infile.replace(".pdf", ".jpg")
+ with open(image_path, "rb") as image_stream:
+ pdf_form.fill_image_field("Image1_af_image", image_stream)
+
+ # Save updated PDF
+ pdf_form.save(outfile)
+
+def get_submit_flags(infile, outfile):
+ # Create Form object
+ pdf_form = pdf_facades.Form()
+
+ # Bind PDF document
+ pdf_form.bind_pdf(infile)
+ flags=pdf_form.get_submit_flags("Submit1_af_submit")
+
+ print(f"Submit flags: {flags}")
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all import form data examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Image Appearance to Button Fields", add_image_appearance_to_button_fields),
+ ("Get Submit Flags", get_submit_flags)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample_form_image.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll managing PDF form fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/formeditor/adding_scripts_and_submit_actions.py b/examples/facades/formeditor/adding_scripts_and_submit_actions.py
new file mode 100644
index 0000000..79ce0c4
--- /dev/null
+++ b/examples/facades/formeditor/adding_scripts_and_submit_actions.py
@@ -0,0 +1,127 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def add_field_script(input_file_name, output_file_name):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Open input PDF file
+ form_editor.bind_pdf(input_file_name)
+
+ # Set JavaScript action for the field
+ form_editor.set_field_script("Script_Demo_Button", "app.alert('Script 1 has been executed');")
+
+ # Add JavaScript action to the field
+ form_editor.add_field_script("Script_Demo_Button", "app.alert('Script 2 has been executed');")
+
+ # Save output PDF file
+ form_editor.save(output_file_name)
+
+def set_field_script(input_file_name, output_file_name):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Open input PDF file
+ form_editor.bind_pdf(input_file_name)
+
+ # Add JavaScript action to the field
+ form_editor.add_field_script("Script_Demo_Button", "app.alert('Script 1 has been executed');")
+
+ # Set JavaScript action for the field
+ form_editor.set_field_script("Script_Demo_Button", "app.alert('Script 2 has been executed');")
+
+ # Save output PDF file
+ form_editor.save(output_file_name)
+
+def remove_field_script(input_file_name, output_file_name):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Open input PDF file
+ form_editor.bind_pdf(input_file_name)
+
+ # Remove JavaScript action from the field
+ form_editor.remove_field_action("Script_Demo_Button")
+
+ # Save output PDF file
+ form_editor.save(output_file_name)
+
+def set_submit_flag(input_file_name, output_file_name):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Open input PDF file
+ form_editor.bind_pdf(input_file_name)
+
+ # Set submit flag for the form
+ form_editor.set_submit_flag("Script_Demo_Button", ap.facades.SubmitFormFlag.XFDF)
+
+ # Save output PDF file
+ form_editor.save(output_file_name)
+
+def set_submit_url(input_file_name, output_file_name):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Set license
+ set_license()
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+
+ # Open input PDF file
+ form_editor.bind_pdf(input_file_name)
+
+ # Set submit URL for the button
+ if not form_editor.set_submit_url("Script_Demo_Button", "http://www.example.com/submit"):
+ raise Exception("Failed to set submit URL")
+
+ # Save output PDF file
+ form_editor.save(output_file_name)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all examples for adding scripts and submit actions with status reporting.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Field Script", add_field_script),
+ ("Set Field Script", set_field_script),
+ ("Remove Field Script", remove_field_script),
+ ("Set Submit Flag", set_submit_flag),
+ ("Set Submit URL", set_submit_url),
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, func.__name__ + ".pdf")
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll Modifying Form Fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/formeditor/creating-form-field.py b/examples/facades/formeditor/creating-form-field.py
new file mode 100644
index 0000000..a20f5a9
--- /dev/null
+++ b/examples/facades/formeditor/creating-form-field.py
@@ -0,0 +1,110 @@
+import sys
+from os import path
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def create_checkbox_field(infile, outfile):
+ """Create CheckBox field in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add CheckBox field to PDF form
+ pdf_form_editor.add_field(pdf_facades.FieldType.CHECK_BOX, "checkbox1", "Check Box 1", 1, 240, 498, 256, 514)
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def create_combobox_field(infile, outfile):
+ """Create ComboBox field in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add ComboBox field to PDF form
+ pdf_form_editor.add_field(pdf_facades.FieldType.COMBO_BOX, "combobox1", "Australia", 1, 230, 498, 350, 514)
+ pdf_form_editor.add_list_item("combobox1", ["Australia","Australia"])
+ pdf_form_editor.add_list_item("combobox1", ["New Zealand","New Zealand"])
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def create_textbox_field(infile, outfile):
+ """Create TextBox field in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add TextBox field to PDF form
+ pdf_form_editor.add_field(pdf_facades.FieldType.TEXT, "first_name", "Alexander", 1, 50, 570, 150, 590)
+ pdf_form_editor.add_field(pdf_facades.FieldType.TEXT, "last_name", "Smith", 1, 235, 570, 330, 590)
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def create_radiobutton_field(infile, outfile):
+ """Create RadioButton field in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add RadioButton field to PDF form
+ pdf_form_editor.items = ["Australia", "New Zealand", "Malaysia"];
+ pdf_form_editor.add_field(pdf_facades.FieldType.RADIO, "radiobutton1", "Malaysia", 1, 240, 498, 256, 514)
+
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def create_listbox_field(infile, outfile):
+ """Create ListBox field in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add ListBox field to PDF form
+ pdf_form_editor.items = ["Australia", "New Zealand", "Malaysia"];
+ pdf_form_editor.add_field(pdf_facades.FieldType.LIST_BOX, "listbox1", "Australia", 1, 230, 398, 350, 514)
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def create_submit_button(infile, outfile):
+ """Create Submit Button in PDF document."""
+ pdf_form_editor = pdf_facades.FormEditor()
+ pdf_form_editor.bind_pdf(infile)
+
+ # Add Submit Button to PDF form
+ pdf_form_editor.add_submit_btn("submitbtn1", 1, "Submit Button", "http://example.com/submit", 100, 450, 200, 470)
+
+ # Save updated PDF document with form fields
+ pdf_form_editor.save(outfile)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all TextBox field examples with status reporting."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Create TextBox Field", create_textbox_field),
+ ("Create CheckBox Field", create_checkbox_field),
+ ("Create ComboBox Field", create_combobox_field),
+ ("Create RadioButton Field", create_radiobutton_field),
+ ("Create ListBox Field", create_listbox_field),
+ ("Create Submit Button", create_submit_button),
+ ]
+
+ for name, func in examples:
+ try:
+ infile = path.join(input_dir, "sample_empty.pdf")
+ outfile = path.join(output_dir, func.__name__ + ".pdf")
+ func(infile, outfile)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/formeditor/customizing-field-appearance.py b/examples/facades/formeditor/customizing-field-appearance.py
new file mode 100644
index 0000000..5262be9
--- /dev/null
+++ b/examples/facades/formeditor/customizing-field-appearance.py
@@ -0,0 +1,176 @@
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pydrawing as ap_pydrawing
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def decorate_field(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+ form_editor.facade = pdf_facades.FormFieldFacade()
+ form_editor.facade.background_color = ap_pydrawing.Color.red
+ form_editor.facade.text_color = ap_pydrawing.Color.blue
+ form_editor.facade.border_color = ap_pydrawing.Color.green
+ form_editor.facade.alignment = pdf_facades.FormFieldFacade.ALIGN_CENTER
+ form_editor.decorate_field("First Name")
+
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def set_field_alignment(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Set field alignment to center
+ if (form_editor.set_field_alignment(
+ "First Name", pdf_facades.FormFieldFacade.ALIGN_CENTER
+ )):
+ # Save updated document
+ form_editor.save(outfile)
+ else:
+ raise Exception("Failed to set field alignment. Field may not support alignment.")
+
+
+def set_field_alignment_vertical(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Set field vertical alignment to top
+ if form_editor.set_field_alignment_v(
+ "First Name", pdf_facades.FormFieldFacade.ALIGN_BOTTOM
+ ):
+ # Save updated document
+ form_editor.save(outfile)
+ else:
+ raise Exception("Failed to set field vertical alignment. Field may not support vertical alignment.")
+
+def set_field_appearance(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Set field appearance to invisible
+ if not form_editor.set_field_appearance("First Name", ap.annotations.AnnotationFlags.INVISIBLE):
+ raise Exception("Failed to set field appearance. Field may not support appearance flags.")
+
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def set_field_attribute(infile, outfile):
+ # # Open document
+ # doc = ap.Document(infile)
+
+ # # Create FormEditor object
+ # form_editor = pdf_facades.FormEditor(doc)
+
+ # # Set field attribute to "ReadOnly"
+ # if not form_editor.set_field_attribute("Country", pdf_facades.PropertyFlags.READ_ONLY):
+ # raise Exception("Failed to set field attribute. Field may not support specified attribute.")
+
+ # Save updated document
+ # form_editor.save(outfile)
+ pass
+
+
+def set_field_comb_number(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Set field comb number to 5
+ form_editor.set_field_comb_number("PIN", 5)
+
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def set_field_limit(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Set field limit to 10
+ if not form_editor.set_field_limit("Last Name", 10):
+ raise Exception("Failed to set field limit. Field may not support specified limit.")
+
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def get_field_appearance(infile, outfile):
+ # Open document
+ doc = ap.Document(infile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor(doc)
+
+ # Get field appearance
+ appearance = form_editor.get_field_appearance("Last Name")
+ print("Field Appearance: " + str(appearance))
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Decorate Field", decorate_field),
+ ("Set Field Alignment", set_field_alignment),
+ ("Set Field Alignment Vertical", set_field_alignment_vertical),
+ ("Set Field Appearance", set_field_appearance),
+ ("Set Field Attribute", set_field_attribute),
+ ("Set Field Comb Number", set_field_comb_number),
+ ("Set Field Limit", set_field_limit),
+ ("Get Field Appearance", get_field_appearance),
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, f"{func.__name__}.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}.pdf")
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll Modifying Form Fields examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/formeditor/modifying-form-fields.py b/examples/facades/formeditor/modifying-form-fields.py
new file mode 100644
index 0000000..31fde24
--- /dev/null
+++ b/examples/facades/formeditor/modifying-form-fields.py
@@ -0,0 +1,135 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def add_list_item(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Add list item to list box field
+ form_editor.add_list_item("Country", ["New Zealand","New Zealand"])
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def del_list_item(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Delete list item from list box field
+ form_editor.del_list_item("Country", "UK")
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def move_field(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Move field to new page
+ form_editor.move_field("Country", 200, 600, 280, 620)
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def remove_field(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Remove field from document
+ form_editor.remove_field("Country")
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def rename_field(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Rename field in document
+ form_editor.rename_field("City", "Town")
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def single2multiple(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Change a single-lined text field to a multiple-lined one
+ form_editor.single_2_multiple("City")
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def copy_inner_field(infile, outfile):
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(infile)
+ # Copies an existing field to a new position specified by both page number and ordinates.
+ # A new document will be produced, which contains everything the source document has except for the newly copied field.
+ form_editor.copy_inner_field("First Name", "First Name Copy", 2, 200, 600)
+ # Save updated document
+ form_editor.save(outfile)
+
+def copy_outer_field(infile, outfile):
+ # Since copy_outer_field() method needs to copy field from source document to target document, we need to create a new document as target document first.
+ doc = ap.Document()
+ doc.pages.add()
+ doc.save(outfile)
+
+ # Create FormEditor object
+ form_editor = pdf_facades.FormEditor()
+ # Bind document to FormEditor
+ form_editor.bind_pdf(outfile)
+ # Copies an existing field to a new position specified by both page number and ordinates.
+ # A new document will be produced, which contains everything the source document has except for the newly copied field.
+ form_editor.copy_outer_field(infile, "First Name", 1, 200, 600)
+ # Save updated document
+ form_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all form field modification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add List Item", add_list_item),
+ ("Delete List Item", del_list_item),
+ ("Move Field", move_field),
+ ("Remove Field", remove_field),
+ ("Rename Field", rename_field),
+ ("Single to Multiple", single2multiple),
+ ("Copy Inner Field", copy_inner_field),
+ ("Copy Outer Field", copy_outer_field),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_content_editor/annotations.py b/examples/facades/pdf_content_editor/annotations.py
new file mode 100644
index 0000000..b486661
--- /dev/null
+++ b/examples/facades/pdf_content_editor/annotations.py
@@ -0,0 +1,101 @@
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def add_text_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add text annotation to page 1
+ content_editor.create_text(apd.Rectangle(100, 400, 50, 50), "Text Annotation", "This is a text annotation", True, "Insert", 1)
+ # Save updated document
+ content_editor.save(outfile)
+
+def add_free_text_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add free text annotation to page 1
+ content_editor.create_free_text(apd.Rectangle(200, 480, 150, 25), "This is a free text annotation", 1)
+ # Save updated document
+ content_editor.save(outfile)
+
+def add_caret_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add caret annotation to page 1
+ content_editor.create_caret(1,
+ apd.Rectangle(350, 400, 10, 10),
+ apd.Rectangle(300, 380, 115, 15),
+ "P", "This is a caret annotation",
+ apd.Color.red)
+ # Save updated document
+ content_editor.save(outfile)
+
+def add_markup_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add markup annotation to page 1
+ content_editor.create_markup(apd.Rectangle(120, 440, 200, 20), "This is a highlight annotation", 0, 1, apd.Color.yellow)
+ content_editor.create_markup(apd.Rectangle(110, 542, 200, 20), "This is a underline annotation", 1, 1, apd.Color.yellow)
+ content_editor.create_markup(apd.Rectangle(120, 568, 200, 20), "This is a strikeout annotation", 2, 1, apd.Color.orange_red)
+ content_editor.create_markup(apd.Rectangle(110, 598, 200, 20), "This is a squiggly annotation", 3, 1, apd.Color.dark_blue)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_popup_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add popup annotation to page 1
+ content_editor.create_popup(
+ apd.Rectangle(220, 520, 180, 80),
+ "This is a popup annotation",
+ True,
+ 1,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all form field modification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Text Annotation", add_text_annotation),
+ ("Add Free Text Annotation", add_free_text_annotation),
+ ("Add Caret Annotation", add_caret_annotation),
+ ("Add Markup Annotation", add_markup_annotation),
+ ("Add Popup Annotation", add_popup_annotation),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
+
diff --git a/examples/facades/pdf_content_editor/attachments.py b/examples/facades/pdf_content_editor/attachments.py
new file mode 100644
index 0000000..4a271b1
--- /dev/null
+++ b/examples/facades/pdf_content_editor/attachments.py
@@ -0,0 +1,129 @@
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+from io import BytesIO
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def add_attachment(infile, attachment_file ,outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add attachment to page 1
+ with open(attachment_file, "rb") as attachment_stream:
+ content_editor.add_document_attachment(
+ attachment_stream,
+ path.basename(attachment_file),
+ "This is a sample attachment for demonstration purposes.",
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_attachment_from_path(infile, attachment_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add attachment using file-path overload
+ content_editor.add_document_attachment(
+ attachment_file,
+ "Attachment added using file path overload.",
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_file_attachment_annotation(infile, attachment_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Create file attachment annotation on page 1
+ content_editor.create_file_attachment(
+ apd.Rectangle(100, 520, 20, 20),
+ "Attachment annotation contents",
+ attachment_file,
+ 1,
+ "PushPin",
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_file_attachment_annotation_from_stream(infile, attachment_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ with open(attachment_file, "rb") as source_stream:
+ attachment_stream = BytesIO(source_stream.read())
+
+ # Create file attachment annotation using stream+opacity overload
+ content_editor.create_file_attachment(
+ apd.Rectangle(130, 520, 20, 20),
+ "Attachment annotation from stream",
+ attachment_stream,
+ path.basename(attachment_file),
+ 1,
+ "Tag",
+ 0.75,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+def remove_attachments(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Remove all attachments from document
+ content_editor.delete_attachments()
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all form field modification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Attachment", add_attachment, True),
+ ("Add Attachment From Path", add_attachment_from_path, True),
+ ("Add File Attachment Annotation", add_file_attachment_annotation, True),
+ (
+ "Add File Attachment Annotation From Stream",
+ add_file_attachment_annotation_from_stream,
+ True,
+ ),
+ ("Remove Attachments", remove_attachments, False),
+ ]
+
+ input_pdf = path.join(input_dir, "sample.pdf")
+ attachment_file = path.join(input_dir, "SampleAttachment.txt")
+
+ for name, func, needs_attachment in examples:
+ try:
+ if needs_attachment:
+ func(input_pdf,
+ attachment_file,
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ else:
+ func(input_pdf,
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_content_editor/binding-and-streams.py b/examples/facades/pdf_content_editor/binding-and-streams.py
new file mode 100644
index 0000000..cae8a0c
--- /dev/null
+++ b/examples/facades/pdf_content_editor/binding-and-streams.py
@@ -0,0 +1,80 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+from io import BytesIO
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def constructor_with_document_and_save_stream(infile, outfile):
+ # Initialize PdfContentEditor using constructor overload that accepts Document
+ document = ap.Document(infile)
+ content_editor = pdf_facades.PdfContentEditor(document)
+
+ # Save to memory stream using save(stream) overload, then persist to file
+ output_stream = BytesIO()
+ content_editor.save(output_stream)
+ with open(outfile, "wb") as target_stream:
+ target_stream.write(output_stream.getvalue())
+
+ content_editor.close()
+
+
+def bind_from_stream_and_save_stream(infile, outfile):
+ # Create editor and bind PDF from in-memory stream
+ content_editor = pdf_facades.PdfContentEditor()
+ with open(infile, "rb") as source_stream:
+ input_stream = BytesIO(source_stream.read())
+ content_editor.bind_pdf(input_stream)
+
+ # Save through stream overload to demonstrate bind(stream) + save(stream)
+ output_stream = BytesIO()
+ content_editor.save(output_stream)
+ with open(outfile, "wb") as target_stream:
+ target_stream.write(output_stream.getvalue())
+
+ content_editor.close()
+
+
+def bind_from_document_and_save_file(infile, outfile):
+ # Create editor and bind from Document overload
+ source_document = ap.Document(infile)
+ content_editor = pdf_facades.PdfContentEditor()
+ content_editor.bind_pdf(source_document)
+
+ # Save to file-path overload
+ content_editor.save(outfile)
+ content_editor.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run PdfContentEditor binding and stream overload examples."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Constructor With Document And Save Stream", constructor_with_document_and_save_stream),
+ ("Bind From Stream And Save Stream", bind_from_stream_and_save_stream),
+ ("Bind From Document And Save File", bind_from_document_and_save_file),
+ ]
+
+ for name, func in examples:
+ try:
+ func(
+ path.join(input_dir, "sample.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_content_editor/document-actions.py b/examples/facades/pdf_content_editor/document-actions.py
new file mode 100644
index 0000000..994bb8d
--- /dev/null
+++ b/examples/facades/pdf_content_editor/document-actions.py
@@ -0,0 +1,81 @@
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def add_bookmark_action(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add a bookmark action to navigate to page 1
+ content_editor.create_bookmarks_action(
+ "PdfContentEditor Bookmark",
+ apd.Color.blue,
+ True,
+ False,
+ "",
+ "GoTo",
+ "1",
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_document_action(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add JavaScript action for document open event
+ content_editor.add_document_additional_action(
+ content_editor.DOCUMENT_OPEN,
+ "app.alert('Document opened with PdfContentEditor action');",
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def remove_open_action(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Remove open action from the document
+ content_editor.remove_document_open_action()
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all document action examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Bookmark Action", add_bookmark_action),
+ ("Add Document Action", add_document_action),
+ ("Remove Open Action", remove_open_action),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
+
diff --git a/examples/facades/pdf_content_editor/drawing-annotations.py b/examples/facades/pdf_content_editor/drawing-annotations.py
new file mode 100644
index 0000000..43537d0
--- /dev/null
+++ b/examples/facades/pdf_content_editor/drawing-annotations.py
@@ -0,0 +1,150 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Drawing Annotations
+# Line
+# Square and Circle
+# Polygon
+# Polyline
+# Curve
+
+def add_line_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ # Create LineAnnotation object
+ rect = apd.Rectangle(100, 100, 200, 200)
+ contents = "This is line annotation"
+ content_editor.create_line(rect, contents, 100, 100, 200, 200, 1, 1, apd.Color.red, "Solid", [3,2], ["Square"])
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+def add_square_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ # Create SquareAnnotation object
+ rect = apd.Rectangle(100, 300, 200, 400)
+ contents = "This is square annotation"
+ content_editor.create_square_circle(rect, contents, apd.Color.blue, True, 1, 3)
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+def add_circle_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ # Create CircleAnnotation object
+ rect = apd.Rectangle(300, 300, 400, 400)
+ contents = "This is circle annotation"
+ content_editor.create_square_circle(rect, contents, apd.Color.blue, False, 1, 3)
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+
+def add_polygon_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ line_info = pdf_facades.LineInfo()
+ line_info.border_style = 0 # 0 - Solid
+ line_info.vertice_coordinate = [100, 200, 150, 260, 220, 220, 200, 160]
+ content_editor.create_polygon(
+ line_info,
+ 1,
+ apd.Rectangle(90, 150, 150, 120),
+ "This is polygon annotation",
+ )
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+
+def add_polyline_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ line_info = pdf_facades.LineInfo()
+ line_info.border_style = 0 # 0 - Solid
+ line_info.vertice_coordinate = [120, 420, 180, 460, 230, 430, 290, 470]
+ content_editor.create_poly_line(
+ line_info,
+ 1,
+ apd.Rectangle(110, 410, 200, 90),
+ "This is polyline annotation",
+ )
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+
+def add_curve_annotation(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind input PDF file
+ content_editor.bind_pdf(infile)
+
+ line_info = pdf_facades.LineInfo()
+ line_info.border_style = 1 # 1 - Dashed
+ line_info.vertice_coordinate = [120, 520, 160, 560, 220, 540, 280, 580]
+ line_info.visibility = True
+ content_editor.draw_curve(
+ line_info,
+ 1,
+ apd.Rectangle(110, 510, 220, 100),
+ "This is curve annotation",
+ )
+
+ # Save output PDF file
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all form field modification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Line Annotation", add_line_annotation),
+ ("Square Annotation", add_square_annotation),
+ ("Circle Annotation", add_circle_annotation),
+ ("Polygon Annotation", add_polygon_annotation),
+ ("Polyline Annotation", add_polyline_annotation),
+ ("Curve Annotation", add_curve_annotation),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_content_editor/images.py b/examples/facades/pdf_content_editor/images.py
new file mode 100644
index 0000000..fbdd69c
--- /dev/null
+++ b/examples/facades/pdf_content_editor/images.py
@@ -0,0 +1,76 @@
+import aspose.pdf.facades as pdf_facades
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def replace_image(infile, image_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Replace image on page 1
+ content_editor.replace_image(1, 1, image_file)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def delete_images(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Delete image on page 1
+ content_editor.delete_image(1, [2])
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def delete_all_image(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Delete all images from the document
+ content_editor.delete_image()
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_examples(data_dir=None, license_path=None):
+ """Run all form field modification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Replace Image", replace_image),
+ ("Delete Image", delete_images),
+ ("Delete All Images", delete_all_image),
+ ]
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "replace_image":
+ func(
+ path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(input_dir, "replacement_image.jpg"),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ else:
+ func(
+ path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+if __name__ == "__main__":
+ run_examples()
diff --git a/examples/facades/pdf_content_editor/link-and-navigation.py b/examples/facades/pdf_content_editor/link-and-navigation.py
new file mode 100644
index 0000000..034cc8f
--- /dev/null
+++ b/examples/facades/pdf_content_editor/link-and-navigation.py
@@ -0,0 +1,170 @@
+import aspose.pdf.facades as pdf_facades
+from aspose.pycore import cast, is_assignable
+import aspose.pydrawing as apd
+import aspose.pdf as ap
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def add_web_link(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add a web link annotation to page 1
+ content_editor.create_web_link(
+ apd.Rectangle(100, 650, 200, 20),
+ "https://products.aspose.com/pdf/python-net/",
+ 1,
+ apd.Color.blue,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_local_link(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add a local link on page 1 to destination page 1
+ content_editor.create_local_link(
+ apd.Rectangle(120, 620, 220, 20),
+ 1,
+ 1,
+ apd.Color.red,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_pdf_document_link(infile, linked_pdf, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add link to another PDF document
+ content_editor.create_pdf_document_link(
+ apd.Rectangle(140, 590, 240, 20),
+ linked_pdf,
+ 1,
+ 1,
+ apd.Color.green,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_javascript_link(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add JavaScript link action
+ content_editor.create_java_script_link(
+ "app.alert('PdfContentEditor JavaScript link');",
+ apd.Rectangle(160, 560, 260, 20),
+ 1,
+ apd.Color.orange,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_application_link(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add application launch link
+ content_editor.create_application_link(
+ apd.Rectangle(180, 530, 260, 20),
+ "notepad.exe",
+ 1,
+ apd.Color.purple,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_custom_action_link(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add custom action link. Empty action list keeps the sample runnable
+ # without requiring additional enum lookups.
+ content_editor.create_custom_action_link(
+ apd.Rectangle(200, 500, 260, 20),
+ 1,
+ apd.Color.dark_red,
+ [],
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def extract_links(infile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Extract links from the document
+ links = content_editor.extract_link()
+
+ count = 0
+ for link in links:
+ count += 1
+ print(f"Link {count}: {link.rect}")
+ if is_assignable(link, ap.annotations.LinkAnnotation):
+ annotation = cast(ap.annotations.LinkAnnotation, link)
+ if is_assignable(annotation.action, ap.annotations.GoToURIAction):
+ action = cast(ap.annotations.GoToURIAction, annotation.action)
+ print(f" URI: {action.uri}")
+
+ if count == 0:
+ print("No links found")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all link and navigation examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Web Link", add_web_link),
+ ("Add Local Link", add_local_link),
+ ("Add PDF Document Link", add_pdf_document_link),
+ ("Add JavaScript Link", add_javascript_link),
+ ("Add Application Link", add_application_link),
+ ("Add Custom Action Link", add_custom_action_link),
+ ("Extract Links", extract_links),
+ ]
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "add_pdf_document_link":
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(input_dir, "linked_document.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ elif func.__name__ == "extract_links":
+ func(path.join(input_dir, "sample_links.pdf"))
+ else:
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_content_editor/multimedia.py b/examples/facades/pdf_content_editor/multimedia.py
new file mode 100644
index 0000000..0cf565e
--- /dev/null
+++ b/examples/facades/pdf_content_editor/multimedia.py
@@ -0,0 +1,64 @@
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def add_movie_annotation(infile, movie_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add movie annotation to page 1
+ content_editor.create_movie(apd.Rectangle(80, 500, 220, 120), movie_file, 1)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def add_sound_annotation(infile, sound_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Add sound annotation to page 1
+ content_editor.create_sound(apd.Rectangle(80, 450, 30, 30), sound_file, "Speaker", 1, "8000")
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all multimedia examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Movie Annotation", add_movie_annotation),
+ ("Add Sound Annotation", add_sound_annotation),
+ ]
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "add_movie_annotation":
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(input_dir, "sample_video.avi"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ else:
+ func(path.join(input_dir, "sample.pdf"),
+ path.join(input_dir, "sample_audio.wav"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
+
diff --git a/examples/facades/pdf_content_editor/stamps.py b/examples/facades/pdf_content_editor/stamps.py
new file mode 100644
index 0000000..fcb0e07
--- /dev/null
+++ b/examples/facades/pdf_content_editor/stamps.py
@@ -0,0 +1,275 @@
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+from io import BytesIO
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def add_rubber_stamp(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ for i in range(1, 5):
+ content_editor.create_rubber_stamp(
+ i,
+ apd.Rectangle(120, 450, 180, 60),
+ "Approved",
+ "Approved by reviewer",
+ apd.Color.green,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def delete_stamp_by_index(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ content_editor.delete_stamp(1, [2,3])
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def manage_stamp_by_id(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(200, 380, 180, 60),
+ "Draft",
+ "Draft stamp for ID-based operations",
+ apd.Color.orange,
+ )
+
+ content_editor.create_rubber_stamp(
+ 2,
+ apd.Rectangle(200, 480, 180, 60),
+ "Draft",
+ "Draft stamp for ID-based operations",
+ apd.Color.orange,
+ )
+
+ # Apply ID-based stamp operations
+ content_editor.hide_stamp_by_id(1, 1)
+ content_editor.show_stamp_by_id(1, 2)
+
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def delete_stamp_by_ids_examples(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ # Create two stamps on page 1 so they can be deleted by ID
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(120, 320, 180, 60),
+ "Draft",
+ "Delete by single ID",
+ apd.Color.orange,
+ )
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(120, 250, 180, 60),
+ "Draft",
+ "Delete by multiple IDs",
+ apd.Color.orange,
+ )
+
+ # Delete by single ID overload and by IDs overload
+ content_editor.delete_stamp_by_id(1, 1)
+ content_editor.delete_stamp_by_ids(1, [2])
+
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def move_stamp_by_index(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ content_editor.create_rubber_stamp(
+ 2,
+ apd.Rectangle(200, 380, 180, 60),
+ "Draft",
+ "Draft stamp for ID-based operations",
+ apd.Color.orange,
+ )
+
+ content_editor.create_rubber_stamp(
+ 2,
+ apd.Rectangle(200, 480, 180, 60),
+ "Draft",
+ "Draft stamp for ID-based operations",
+ apd.Color.orange,
+ )
+ content_editor.save(outfile)
+
+ # Move first stamp on page 1 by index
+ # content_editor.move_stamp(1, 1, 10, 10)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def move_stamp_by_id_example(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(300, 420, 180, 60),
+ "Approved",
+ "Move this stamp by ID",
+ apd.Color.green,
+ )
+
+ # Move stamp by ID overload
+ content_editor.move_stamp_by_id(1, 1, 240, 360)
+
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def create_rubber_stamp_with_appearance_file(infile, image_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Create rubber stamp using appearance_file overload (image path)
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(100, 400, 200, 60),
+ "Stamp with custom appearance",
+ apd.Color.dark_green,
+ image_file,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def create_rubber_stamp_with_appearance_stream(infile, image_file, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Read image into an in-memory stream
+ with open(image_file, "rb") as src:
+ appearance_stream = BytesIO(src.read())
+ # Create rubber stamp using appearance_stream overload
+ content_editor.create_rubber_stamp(
+ 1,
+ apd.Rectangle(100, 320, 200, 60),
+ "Stamp with appearance stream",
+ apd.Color.dark_green,
+ appearance_stream,
+ )
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def delete_stamps_globally(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ # Add stamps across multiple pages so global deletion is meaningful
+ for page in range(1, 5):
+ content_editor.create_rubber_stamp(
+ page,
+ apd.Rectangle(120, 500, 180, 60),
+ "Draft",
+ "Stamp for global deletion",
+ apd.Color.gray,
+ )
+
+ # delete_stamp_by_id without page number removes stamp ID from all pages
+ content_editor.delete_stamp_by_id(1)
+ # delete_stamp_by_ids without page number removes a list of IDs from all pages
+ content_editor.delete_stamp_by_ids([2, 3])
+
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def list_stamps(infile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # List all stamps on page 1
+ stamps = content_editor.get_stamps(1)
+
+ count = 0
+ for stamp in stamps:
+ count += 1
+ print(f"Stamp {count}: {stamp}")
+
+ if count == 0:
+ print("No stamps found")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all stamp examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Rubber Stamp", add_rubber_stamp),
+ ("Delete Stamp By Index", delete_stamp_by_index),
+ ("Manage Stamp By ID", manage_stamp_by_id),
+ ("Delete Stamp By IDs", delete_stamp_by_ids_examples),
+ ("Move Stamp By Index", move_stamp_by_index),
+ ("Move Stamp By ID", move_stamp_by_id_example),
+ ("Create Rubber Stamp With Appearance File", create_rubber_stamp_with_appearance_file),
+ ("Create Rubber Stamp With Appearance Stream", create_rubber_stamp_with_appearance_stream),
+ ("Delete Stamps Globally", delete_stamps_globally),
+ ("List Stamps", list_stamps),
+ ]
+
+ image_file = path.join(input_dir, "replacement_image.jpg")
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "list_stamps":
+ func(path.join(input_dir, f"{func.__name__}.pdf"))
+ elif func.__name__ in (
+ "create_rubber_stamp_with_appearance_file",
+ "create_rubber_stamp_with_appearance_stream",
+ ):
+ func(
+ path.join(input_dir, "sample4pages.pdf"),
+ image_file,
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ else:
+ func(path.join(input_dir, f"sample4pages.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_content_editor/text-editing.py b/examples/facades/pdf_content_editor/text-editing.py
new file mode 100644
index 0000000..8c46f93
--- /dev/null
+++ b/examples/facades/pdf_content_editor/text-editing.py
@@ -0,0 +1,112 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+def replace_text_simple(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Replace text in the whole document
+ content_editor.replace_text_strategy.replace_scope = pdf_facades.ReplaceTextStrategy.Scope.REPLACE_ALL
+ content_editor.replace_text("33", "XXXIII ")
+ # Save updated document
+ content_editor.save(outfile)
+
+def replace_text_regex(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Replace text in the whole document
+ content_editor.replace_text_strategy.replace_scope = pdf_facades.ReplaceTextStrategy.Scope.REPLACE_ALL
+ content_editor.replace_text_strategy.is_regular_expression_used = True
+ content_editor.replace_text(r"\d{4}", "[NUMBER]")
+ # Save updated document
+ content_editor.save(outfile)
+
+def replace_text_on_page(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Replace text on page 1
+ content_editor.replace_text_strategy.replace_scope = pdf_facades.ReplaceTextStrategy.Scope.REPLACE_FIRST
+ content_editor.replace_text("PDF", "Page 1 Replaced Text", 14)
+ # Save updated document
+ content_editor.save(outfile)
+
+def replace_text_with_state(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ text_state = ap.text.TextState()
+ text_state.foreground_color = ap.Color.blue
+ text_state.font_size = 14
+
+ # Replace text with explicit text formatting
+ content_editor.replace_text_strategy.replace_scope = pdf_facades.ReplaceTextStrategy.Scope.REPLACE_ALL
+ content_editor.replace_text("software", "SOFTWARE", text_state)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def replace_text_on_page_with_state(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ text_state = ap.text.TextState()
+ text_state.foreground_color = ap.Color.red
+ text_state.font_size = 12
+
+ # Replace text on a specific page with explicit text formatting
+ content_editor.replace_text_strategy.replace_scope = pdf_facades.ReplaceTextStrategy.Scope.REPLACE_ALL
+ content_editor.replace_text("software", 1, "SOFTWARE PAGE 1", text_state)
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all text editing examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Replace Text Simple", replace_text_simple),
+ ("Replace Text Regex", replace_text_regex),
+ ("Replace Text On Page", replace_text_on_page),
+ ("Replace Text With State", replace_text_with_state),
+ ("Replace Text On Page With State", replace_text_on_page_with_state),
+ ]
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "replace_text_on_page_with_state":
+ func(
+ path.join(input_dir, "replace_text_with_state.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ else:
+ func(path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_content_editor/viewer-preferences.py b/examples/facades/pdf_content_editor/viewer-preferences.py
new file mode 100644
index 0000000..e53bf54
--- /dev/null
+++ b/examples/facades/pdf_content_editor/viewer-preferences.py
@@ -0,0 +1,104 @@
+import aspose.pdf.facades as pdf_facades
+import sys
+from enum import IntFlag
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+class ViewerPreference(IntFlag):
+ """Bit flags for PDF viewer preferences."""
+
+ PAGE_LAYOUT_SINGLE_PAGE = 1
+ PAGE_LAYOUT_ONE_COLUMN = 2
+ PAGE_LAYOUT_TWO_COLUMN_LEFT = 4
+ PAGE_LAYOUT_TWO_COLUMN_RIGHT = 8
+
+ PAGE_MODE_USE_NONE = 16
+ PAGE_MODE_USE_OUTLINES = 32
+ PAGE_MODE_USE_THUMBS = 64
+ PAGE_MODE_FULL_SCREEN = 128
+
+ HIDE_TOOLBAR = 256
+ HIDE_MENUBAR = 512
+ HIDE_WINDOW_UI = 1024
+ FIT_WINDOW = 2048
+ CENTER_WINDOW = 4096
+
+ NON_FULL_SCREEN_PAGE_MODE_USE_NONE = 8192
+ NON_FULL_SCREEN_PAGE_MODE_USE_OUTLINES = 16384
+ NON_FULL_SCREEN_PAGE_MODE_USE_THUMBS = 32768
+
+ DIRECTION_L2R = 65536
+ DIRECTION_R2L = 131072
+
+ DISPLAY_DOC_TITLE = 262144
+ NON_FULL_SCREEN_PAGE_MODE_USE_OC = 524288
+ PAGE_MODE_USE_OC = 1048576
+ PAGE_MODE_USE_ATTACHMENT = 2097152
+
+ SIMPLEX = 4194304
+ DUPLEX_FLIP_SHORT_EDGE = 8388608
+ DUPLEX_FLIP_LONG_EDGE = 16777216
+ PRINT_SCALING_APP_DEFAULT = 1 << 25
+ PRINT_SCALING_NONE = 1 << 26
+ PICK_TRAY_BY_PDF_SIZE = 1 << 27
+
+
+
+def get_viewer_preferences(infile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+ # Read current viewer preference flags
+ viewer_preference = ViewerPreference(content_editor.get_viewer_preference())
+ if viewer_preference & ViewerPreference.PAGE_MODE_USE_OUTLINES:
+ print("PageModeUseOutlines is enabled")
+ print(f"Current viewer preference: {viewer_preference}")
+
+
+def change_viewer_preferences(infile, outfile):
+ # Create PdfContentEditor object
+ content_editor = pdf_facades.PdfContentEditor()
+ # Bind document to PdfContentEditor
+ content_editor.bind_pdf(infile)
+
+ current_preference = ViewerPreference(content_editor.get_viewer_preference())
+ # Toggle one low-order flag to demonstrate viewer preference update
+ updated_preference = current_preference | ViewerPreference.PAGE_LAYOUT_SINGLE_PAGE
+ content_editor.change_viewer_preference(int(updated_preference))
+
+ # Save updated document
+ content_editor.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all viewer preference examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get Viewer Preferences", get_viewer_preferences),
+ ("Change Viewer Preferences", change_viewer_preferences),
+ ]
+
+ for name, func in examples:
+ try:
+ if func.__name__ == "get_viewer_preferences":
+ func(path.join(input_dir, f"{func.__name__}.pdf"))
+ else:
+ func(path.join(input_dir, f"{func.__name__}.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_editor/booklet-and-nup-layout.py b/examples/facades/pdf_file_editor/booklet-and-nup-layout.py
new file mode 100644
index 0000000..574e083
--- /dev/null
+++ b/examples/facades/pdf_file_editor/booklet-and-nup-layout.py
@@ -0,0 +1,82 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+from io import FileIO
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Create PDF Booklet
+def create_pdf_booklet(infile, outfile):
+ # Create BookletMaker object
+ booklet_maker = pdf_facades.PdfFileEditor()
+ # Make booklet from input PDF file and save to output PDF file
+ booklet_maker.make_booklet(FileIO(infile), FileIO(outfile, "w"))
+
+def try_create_pdf_booklet(infile, outfile):
+ # Create BookletMaker object
+ booklet_maker = pdf_facades.PdfFileEditor()
+ # Make booklet from input PDF file and save to output PDF file
+ # The try_make_booklet method is like the make_booklet method,
+ # except the try_make_booklet method does not throw an exception if the operation fails.
+ if not booklet_maker.try_make_booklet(FileIO(infile), FileIO(outfile, "w")):
+ print("Failed to create booklet.")
+
+
+# Create N-Up PDF Document
+def create_nup_pdf_document(infile, outfile):
+ # Create NUpMaker object
+ nup_maker = pdf_facades.PdfFileEditor()
+ # Make N-Up layout from input PDF file and save to output PDF file
+ nup_maker.make_n_up(FileIO(infile), FileIO(outfile, "w"), 2, 2) # 2 rows and 2 columns for N-Up layout
+
+# Create N-Up PDF Document
+def try_create_nup_pdf_document(infile, outfile):
+ # Create NUpMaker object
+ nup_maker = pdf_facades.PdfFileEditor()
+ # Make N-Up layout from input PDF file and save to output PDF file
+ if not nup_maker.try_make_n_up(FileIO(infile), FileIO(outfile, "w"), 2, 2):
+ print("Failed to create N-Up PDF document.")
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all booklet and N-Up layout examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+
+ ("Create PDF Booklet", create_pdf_booklet),
+ ("Create N-Up PDF Document", create_nup_pdf_document),
+ ("Try Create PDF Booklet", try_create_pdf_booklet),
+ ("Try Create N-Up PDF Document", try_create_nup_pdf_document)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, func.__name__ + ".pdf")
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll booklet and N-Up layout examples finished.\n")
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_editor/merge-pdf-documents.py b/examples/facades/pdf_file_editor/merge-pdf-documents.py
new file mode 100644
index 0000000..020481c
--- /dev/null
+++ b/examples/facades/pdf_file_editor/merge-pdf-documents.py
@@ -0,0 +1 @@
+#─ Concatenate or Merge PDF Files
\ No newline at end of file
diff --git a/examples/facades/pdf_file_editor/page-layout-and-margins.py b/examples/facades/pdf_file_editor/page-layout-and-margins.py
new file mode 100644
index 0000000..e27a27c
--- /dev/null
+++ b/examples/facades/pdf_file_editor/page-layout-and-margins.py
@@ -0,0 +1,96 @@
+# Page Layout & Margins
+# ─ Add Margins to PDF Pages
+# ─ Resize PDF Page Contents
+# ─ Add Page Breaks in PDF
+
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+# Add Margins to PDF Pages
+def add_margins_to_pdf_pages(infile, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ # Define the margins to be added (in points)
+ left_margin = 36 # 0.5 inch
+ right_margin = 36 # 0.5 inch
+ top_margin = 36 # 0.5 inch
+ bottom_margin = 36 # 0.5 inch
+
+ pdf_editor.add_margins(
+ infile, outfile, [1, 3], left_margin, right_margin, top_margin, bottom_margin
+ )
+
+
+# Resize PDF Page Contents
+def resize_pdf_page_contents(infile, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+
+ if not pdf_editor.resize_contents(
+ FileIO(infile), FileIO(outfile, "w"), [1, 3], 400, 750
+ ):
+ raise Exception("Failed to resize PDF page contents.")
+
+
+# Add Page Breaks in PDF
+def add_page_breaks_in_pdf(infile, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.add_page_break(
+ infile,
+ outfile,
+ [
+ pdf_facades.PdfFileEditor.PageBreak(1, 400),
+ ],
+ )
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all page layout and margins examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Add Margins to PDF Pages", add_margins_to_pdf_pages),
+ ("Resize PDF Page Contents", resize_pdf_page_contents),
+ (
+ "Add Page Breaks in PDF",
+ add_page_breaks_in_pdf,
+ ),
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, func.__name__ + ".pdf")
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll page layout and margins examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_editor/page-managment.py b/examples/facades/pdf_file_editor/page-managment.py
new file mode 100644
index 0000000..e4e02ae
--- /dev/null
+++ b/examples/facades/pdf_file_editor/page-managment.py
@@ -0,0 +1,101 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+from config import set_license, initialize_data_dir
+
+
+# Extract Pages from PDF
+def extract_pages_from_pdf(infile, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+
+ # Define the page numbers to be extracted (1-based index)
+ pages_to_extract = [1, 4, 3]
+
+ # Extract the specified pages from the PDF document and save to a new PDF document
+ pdf_editor.extract(infile, pages_to_extract, outfile)
+
+
+# Delete Pages from PDF
+def delete_pages_from_pdf(infile, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+
+ # Define the page numbers to be deleted (1-based index)
+ pages_to_delete = [2, 4]
+
+ # Delete the specified pages from the PDF document
+ pdf_editor.delete(infile, pages_to_delete, outfile)
+
+
+# Insert Pages into PDF
+def insert_pages_into_pdf(infile, sample_file, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+
+ # Define the page number where new pages will be inserted (1-based index)
+ insert_page_number = 2
+
+ pdf_editor.insert(infile, insert_page_number, sample_file, [1, 2], outfile)
+
+
+# Append Pages to PDF
+def append_pages_to_pdf(infile, sample_file, outfile):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ # Append pages from the specified PDF document to the end of the source PDF document
+ pdf_editor.append(infile, [sample_file], 1, 2, outfile)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all page management examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Insert Pages into PDF", insert_pages_into_pdf),
+ ("Append Pages to PDF", append_pages_to_pdf),
+ ("Extract Pages from PDF", extract_pages_from_pdf),
+ ("Delete Pages from PDF", delete_pages_from_pdf),
+ ]
+
+ for name, func in examples:
+ input_file_name = path.join(input_dir, func.__name__ + ".pdf")
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ try:
+ if (
+ func.__name__ == "insert_pages_into_pdf"
+ or func.__name__ == "append_pages_to_pdf"
+ ):
+ func(
+ input_file_name,
+ path.join(input_dir, "sample_data.pdf"),
+ output_file_name,
+ )
+ else:
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll page management examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_editor/page-merging.py b/examples/facades/pdf_file_editor/page-merging.py
new file mode 100644
index 0000000..bde495f
--- /dev/null
+++ b/examples/facades/pdf_file_editor/page-merging.py
@@ -0,0 +1,99 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+from config import set_license, initialize_data_dir
+
+def concatenate_two_files(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.concatenate(files_to_merge[0], files_to_merge[1], output_file)
+
+def concatenate_pdf_files(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.concatenate(files_to_merge, output_file)
+
+
+def try_concatenate_two_files(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ if not pdf_editor.try_concatenate(files_to_merge[0], files_to_merge[1], output_file):
+ print("Concatenation failed for the provided files.")
+
+def try_concatenate_pdf_files(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ if not pdf_editor.try_concatenate(files_to_merge, output_file):
+ print("Concatenation failed for the provided files.")
+
+def concatenate_large_number_files(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.use_disk_buffer = True # Enable disk buffering for large files
+ pdf_editor.concatenate(files_to_merge, output_file)
+
+def concatenate_pdf_files_with_optimization(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.optimize_size = True # Enable optimization for smaller output file size
+ pdf_editor.concatenate(files_to_merge, output_file)
+
+def concatenate_pdf_forms(files_to_merge, output_file):
+ # Create a PdfFileEditor object
+ pdf_editor = pdf_facades.PdfFileEditor()
+ pdf_editor.unique_suffix = "_xy_%NUM%" # Set a unique suffix to avoid form field name conflicts
+ pdf_editor.concatenate(files_to_merge, output_file)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all page management examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Concatenate Two PDF Files", concatenate_two_files),
+ ("Concatenate Multiple PDF Files", concatenate_pdf_files),
+ ("Try Concatenate Two PDF Files", try_concatenate_two_files),
+ ("Try Concatenate Multiple PDF Files", try_concatenate_pdf_files),
+ ("Concatenate Large Number of PDF Files", concatenate_large_number_files),
+ ("Concatenate PDF Files with Optimization", concatenate_pdf_files_with_optimization),
+ ("Concatenate PDF Forms with Unique Suffix", concatenate_pdf_forms)
+ ]
+
+ input_files = ["merge_1.pdf", "merge_2.pdf", "merge_3.pdf"] # Example input files
+ form_files = ["form1.pdf", "form2.pdf"] # Example form files for concatenation
+ pdf_files_to_merge = [path.join(input_dir, file) for file in input_files]
+ form_files_to_merge = [path.join(input_dir, file) for file in form_files]
+
+ for name, func in examples:
+ try:
+ if "Form" in name:
+ func(form_files_to_merge, path.join(output_dir, func.__name__ + ".pdf"))
+ else:
+ func(pdf_files_to_merge, path.join(output_dir, func.__name__ + ".pdf"))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll page management examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_editor/splitting-pdf-documents.py b/examples/facades/pdf_file_editor/splitting-pdf-documents.py
new file mode 100644
index 0000000..f4e425f
--- /dev/null
+++ b/examples/facades/pdf_file_editor/splitting-pdf-documents.py
@@ -0,0 +1,66 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Split PDF from Beginning
+def split_pdf_from_beginning(input_pdf_path, output_pdf_path):
+ pdf_file_editor = pdf_facades.PdfFileEditor()
+ pdf_file_editor.split_from_first(input_pdf_path, 3, output_pdf_path)
+
+# Split PDF to End
+def split_pdf_to_end(input_pdf_path, output_pdf_path):
+ pdf_file_editor = pdf_facades.PdfFileEditor()
+ pdf_file_editor.split_to_end(input_pdf_path, 2, output_pdf_path)
+
+# Split PDF into Single Pages
+def split_pdf_into_single_pages(input_pdf_path, output_pdf_path):
+ pdf_file_editor = pdf_facades.PdfFileEditor()
+ pdf_file_editor.split_to_pages(input_pdf_path, output_pdf_path)
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all page splitting examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Split PDF from Beginning", split_pdf_from_beginning),
+ ("Split PDF to End", split_pdf_to_end),
+ ("Split PDF into Single Pages", split_pdf_into_single_pages)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, func.__name__ + ".pdf")
+ if func.__name__ == "split_pdf_into_single_pages":
+ output_file_name = path.join(output_dir, func.__name__ + "_%NUM%.pdf")
+ else:
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll page splitting examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_info/document-properties.py b/examples/facades/pdf_file_info/document-properties.py
new file mode 100644
index 0000000..b3dacd7
--- /dev/null
+++ b/examples/facades/pdf_file_info/document-properties.py
@@ -0,0 +1,67 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def get_pdf_version(input_file_name):
+
+ pdf_metadata = pdf_facades.PdfFileInfo(input_file_name)
+ version = pdf_metadata.get_pdf_version()
+ print(f"\nPDF Version: {version}")
+
+def get_document_privileges(input_file_name):
+ pdf_metadata = pdf_facades.PdfFileInfo(input_file_name)
+
+ privileges = pdf_metadata.get_document_privilege()
+
+ print("Document Privileges:")
+ print(f" Can Print: {privileges.allow_print}")
+ print(f" Can Degraded Print: {privileges.allow_degraded_printing}")
+ print(f" Can Copy: {privileges.allow_copy}")
+ print(f" Can Modify Contents: {privileges.allow_modify_contents}")
+ print(f" Can Modify Annotations: {privileges.allow_modify_annotations}")
+ print(f" Can Fill In: {privileges.allow_fill_in}")
+ print(f" Can Screen Readers: {privileges.allow_screen_readers}")
+ print(f" Can Assembly: {privileges.allow_assembly}")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF metadata examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get PDF Version", get_pdf_version),
+ ("Get Document Privileges", get_document_privileges)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample.pdf")
+ func(input_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll PDF metadata examples finished.\n")
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_info/page-information.py b/examples/facades/pdf_file_info/page-information.py
new file mode 100644
index 0000000..d2db14d
--- /dev/null
+++ b/examples/facades/pdf_file_info/page-information.py
@@ -0,0 +1,68 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+def get_page_information(infile):
+
+ # Get and display PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+ page_width = pdf_info.get_page_width(1)
+ page_height = pdf_info.get_page_height(1)
+ page_rotation = pdf_info.get_page_rotation(1)
+ page_x_offset = pdf_info.get_page_x_offset(1)
+ page_y_offset = pdf_info.get_page_y_offset(1)
+
+ print(f"Page Width: {page_width}")
+ print(f"Page Height: {page_height}")
+ print(f"Page Rotation: {page_rotation}")
+
+def get_page_offsets(infile):
+ # Get and display PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+ page_x_offset = pdf_info.get_page_x_offset(1)/72.0
+ page_y_offset = pdf_info.get_page_y_offset(1)/72.0
+ print(f"Page X Offset: {page_x_offset} inches")
+ print(f"Page Y Offset: {page_y_offset} inches")
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF metadata examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get Page Information", get_page_information, "sample2.pdf"),
+ ("Get Page Offsets", get_page_offsets, "sample3.pdf")
+ ]
+
+ for name, func, file_name in examples:
+ try:
+ input_file_name = path.join(input_dir, file_name)
+ func(input_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll PDF metadata examples finished.\n")
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_info/pdf-metadata.py b/examples/facades/pdf_file_info/pdf-metadata.py
new file mode 100644
index 0000000..7d15e16
--- /dev/null
+++ b/examples/facades/pdf_file_info/pdf-metadata.py
@@ -0,0 +1,124 @@
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+from io import FileIO
+
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+# PDF Metadata
+# ├─ Get PDF Metadata
+# ├─ Set PDF Metadata
+# ├─ Clear PDF Metadata
+# └─ Save Metadata with XMP
+
+def get_pdf_metadata(infile):
+
+ # Get and display PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+ print(f"Subject: {pdf_info.subject}")
+ print(f"Title: {pdf_info.title}")
+ print(f"Keywords: {pdf_info.keywords}")
+ print(f"Creator: {pdf_info.creator}")
+ print(f"Creation Date: {pdf_info.creation_date}")
+ print(f"Modification Date: {pdf_info.mod_date}")
+
+ # Check PDF status
+ print(f"Is Valid PDF: {pdf_info.is_pdf_file}")
+ print(f"Is Encrypted: {pdf_info.is_encrypted}")
+ print(f"Has Open Password: {pdf_info.has_open_password}")
+ print(f"Has Edit Password: {pdf_info.has_edit_password}")
+ print(f"Is Portfolio: {pdf_info.has_collection}")
+
+ # Retrieve and display a specific custom attribute
+ reviewer = pdf_info.get_meta_info("Reviewer")
+ print(f"Reviewer: {reviewer if reviewer else 'No Reviewer metadata found.'}")
+
+def set_pdf_metadata(infile, outfile):
+
+ # Get PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+
+ # Set PDF metadata
+ pdf_info.subject = "Aspose PDF for Python via .NET"
+ pdf_info.title = "Aspose PDF for Python via .NET"
+ pdf_info.keywords = "Aspose, PDF, Python, .NET"
+ pdf_info.creator = "Aspose Team"
+
+ pdf_info.set_meta_info("CustomKey", "CustomValue")
+
+ # pdf_info.save_new_info(outfile)
+ # Is obsolete, use save() method instead
+
+ # Save updated metadata
+ pdf_info.save(outfile)
+
+def clear_pdf_metadata(infile, outfile):
+
+ # Get PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+
+ # Clear PDF metadata
+ pdf_info.clear_info()
+
+ # Save updated metadata
+ pdf_info.save(outfile)
+
+def save_info_with_xmp(infile, outfile):
+
+ # Get PDF information
+ pdf_info = pdf_facades.PdfFileInfo(infile)
+
+ # Set PDF metadata
+ pdf_info.subject = "Aspose PDF for Python via .NET"
+ pdf_info.title = "Aspose PDF for Python via .NET"
+ pdf_info.keywords = "Aspose, PDF, Python, .NET"
+ pdf_info.creator = "Aspose Team"
+
+ # Save updated metadata
+ pdf_info.save_new_info_with_xmp(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF metadata examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get PDF Metadata", get_pdf_metadata),
+ ("Set PDF Metadata", set_pdf_metadata),
+ ("Clear PDF Metadata", clear_pdf_metadata),
+ ("Save Metadata with XMP", save_info_with_xmp)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample.pdf")
+ output_file_name = path.join(output_dir, func.__name__ + ".pdf")
+ if func.__name__ == "get_pdf_metadata":
+ func(input_file_name)
+ else:
+ func(input_file_name, output_file_name)
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll PDF metadata examples finished.\n")
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_security/change-password.py b/examples/facades/pdf_file_security/change-password.py
new file mode 100644
index 0000000..ddc3caf
--- /dev/null
+++ b/examples/facades/pdf_file_security/change-password.py
@@ -0,0 +1,123 @@
+# Change User and Owner Password
+# ├── Change User and Owner Password
+# ├── Change Password and Reset Security
+# └── Try Change Password Without Exception
+
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+# Change User and Owner Password
+def change_user_and_owner_password(infile, outfile):
+ """Change user and owner passwords while keeping existing security settings."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Change passwords
+ file_security.change_password(
+ "owner_password",
+ "new_user_password",
+ "new_owner_password"
+ )
+
+ # Save updated PDF
+ file_security.save(outfile)
+
+
+# Change Password and Reset Security
+def change_password_and_reset_security(infile, outfile):
+ """Change passwords and reset document security settings."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define new privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+
+ # Change passwords and reset security
+ file_security.change_password(
+ "owner_password",
+ "new_user_password",
+ "new_owner_password",
+ privilege,
+ pdf_facades.KeySize.X128
+ )
+
+ # Save updated PDF
+ file_security.save(outfile)
+
+
+# Try Change Password Without Exception
+def try_change_password_without_exception(infile, outfile):
+ """Attempt to change passwords without throwing an exception on failure."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Attempt to change passwords
+ result = file_security.try_change_password(
+ "owner_password",
+ "new_user_password",
+ "new_owner_password"
+ )
+
+ # Save only if operation succeeded
+ if result:
+ file_security.save(outfile)
+ else:
+ print("Password change failed. Check owner password or document security.")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all change password examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Change User and Owner Password", change_user_and_owner_password),
+ ("Change Password and Reset Security", change_password_and_reset_security),
+ ("Try Change Password Without Exception", try_change_password_without_exception)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "secured.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll change password examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_security/decrypt-pdf.py b/examples/facades/pdf_file_security/decrypt-pdf.py
new file mode 100644
index 0000000..fcc980c
--- /dev/null
+++ b/examples/facades/pdf_file_security/decrypt-pdf.py
@@ -0,0 +1,83 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+# Decrypt PDF with Owner Password
+def decrypt_pdf_with_owner_password(infile, outfile):
+ """Decrypt a PDF document using the owner password."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Decrypt the PDF
+ file_security.decrypt_file("owner_password")
+
+ # Save decrypted PDF
+ file_security.save(outfile)
+
+
+# Try Decrypt PDF Without Exception
+def try_decrypt_pdf_without_exception(infile, outfile):
+ """Attempt to decrypt a PDF without throwing an exception on failure."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Attempt to decrypt the PDF
+ result = file_security.try_decrypt_file("owner_password")
+
+ # Save only if decryption was successful
+ if result:
+ file_security.save(outfile)
+ else:
+ print("Decryption failed. Check password or document security.")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all decrypt PDF examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Decrypt PDF with Owner Password", decrypt_pdf_with_owner_password),
+ ("Try Decrypt PDF Without Exception", try_decrypt_pdf_without_exception)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "encrypted.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll decrypt PDF examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_security/encrypt-pdf.py b/examples/facades/pdf_file_security/encrypt-pdf.py
new file mode 100644
index 0000000..16f4f02
--- /dev/null
+++ b/examples/facades/pdf_file_security/encrypt-pdf.py
@@ -0,0 +1,125 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+# Encrypt PDF with User and Owner Password
+def encrypt_pdf_with_user_owner_password(infile, outfile):
+ """Encrypt a PDF document using user and owner passwords."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define document privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+
+ # Encrypt the PDF
+ file_security.encrypt_file(
+ "user_password",
+ "owner_password",
+ privilege,
+ pdf_facades.KeySize.X128
+ )
+
+ # Save encrypted PDF
+ file_security.save(outfile)
+
+
+# Encrypt PDF with Permissions
+def encrypt_pdf_with_permissions(infile, outfile):
+ """Encrypt a PDF document and configure specific permissions."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Configure privileges
+ privilege = pdf_facades.DocumentPrivilege.allow_all
+ privilege.allow_print = False
+ privilege.allow_copy = False
+
+ # Encrypt the PDF
+ file_security.encrypt_file(
+ "user_password",
+ "owner_password",
+ privilege,
+ pdf_facades.KeySize.X128
+ )
+
+ # Save encrypted PDF
+ file_security.save(outfile)
+
+
+# Encrypt PDF with Encryption Algorithm
+def encrypt_pdf_with_encryption_algorithm(infile, outfile):
+ """Encrypt a PDF document using a specific encryption algorithm."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+
+ # Encrypt the PDF using AES algorithm
+ file_security.encrypt_file(
+ "user_password",
+ "owner_password",
+ privilege,
+ pdf_facades.KeySize.X256,
+ pdf_facades.Algorithm.AES
+ )
+
+ # Save encrypted PDF
+ file_security.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all encrypt PDF examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Encrypt PDF with User and Owner Password", encrypt_pdf_with_user_owner_password),
+ ("Encrypt PDF with Permissions", encrypt_pdf_with_permissions),
+ ("Encrypt PDF with Encryption Algorithm", encrypt_pdf_with_encryption_algorithm)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll encrypt PDF examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_security/set-privileges.py b/examples/facades/pdf_file_security/set-privileges.py
new file mode 100644
index 0000000..d9c74e1
--- /dev/null
+++ b/examples/facades/pdf_file_security/set-privileges.py
@@ -0,0 +1,121 @@
+from io import FileIO
+import sys
+from os import path
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import set_license, initialize_data_dir
+
+
+# Set PDF Privileges Without Passwords
+def set_pdf_privileges_without_passwords(infile, outfile):
+ """Set PDF privileges without specifying user and owner passwords."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+
+ # Apply privileges (owner password will be generated automatically)
+ file_security.set_privilege(privilege)
+
+ # Save updated PDF
+ file_security.save(outfile)
+
+
+# Set PDF Privileges with User and Owner Passwords
+def set_pdf_privileges_with_passwords(infile, outfile):
+ """Set PDF privileges using user and owner passwords."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+ privilege.allow_copy = False
+
+ # Apply privileges with passwords
+ file_security.set_privilege(
+ "user_password",
+ "owner_password",
+ privilege
+ )
+
+ # Save updated PDF
+ file_security.save(outfile)
+
+
+# Try Set PDF Privileges Without Exception
+def try_set_pdf_privileges_without_exception(infile, outfile):
+ """Attempt to set PDF privileges without throwing an exception on failure."""
+ # Create PdfFileSecurity object
+ file_security = pdf_facades.PdfFileSecurity()
+
+ # Bind PDF document
+ file_security.bind_pdf(infile)
+
+ # Define privileges
+ privilege = pdf_facades.DocumentPrivilege.forbid_all
+ privilege.allow_print = True
+
+ # Attempt to apply privileges
+ result = file_security.try_set_privilege(
+ "user_password",
+ "owner_password",
+ privilege
+ )
+
+ # Save only if operation succeeded
+ if result:
+ file_security.save(outfile)
+ else:
+ print("Setting privileges failed. Check passwords or document state.")
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all set PDF privileges examples and report status.
+
+ Args:
+ data_dir (str, optional): Input/output directory override.
+ license_path (str, optional): Path to Aspose.PDF license file.
+
+ Returns:
+ None
+ """
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Set PDF Privileges Without Passwords", set_pdf_privileges_without_passwords),
+ ("Set PDF Privileges with User and Owner Passwords", set_pdf_privileges_with_passwords),
+ ("Try Set PDF Privileges Without Exception", try_set_pdf_privileges_without_exception)
+ ]
+
+ for name, func in examples:
+ try:
+ input_file_name = path.join(input_dir, "sample.pdf")
+ output_file_name = path.join(output_dir, f"{func.__name__}_out.pdf")
+ func(input_file_name, output_file_name)
+
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed: {name} - {str(e)}")
+
+ print("\nAll set PDF privileges examples finished.")
+
+
+if __name__ == "__main__":
+ run_all_examples()
\ No newline at end of file
diff --git a/examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py b/examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py
new file mode 100644
index 0000000..7856ecc
--- /dev/null
+++ b/examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py
@@ -0,0 +1,133 @@
+import os
+from os import path
+
+import aspose.pdf as ap
+import aspose.pdf.facades as pdf_facades
+import aspose.pydrawing as apd
+
+
+DEFAULT_CERTIFICATE_FILENAME = "certificate.pfx"
+DEFAULT_CERTIFICATE_PASSWORD = "Aspose2021"
+DEFAULT_INPUT_PDF = "sample.pdf"
+DEFAULT_SIGNED_PDF = "signed.pdf"
+DEFAULT_CERTIFIED_PDF = "certified.pdf"
+DEFAULT_SIGNATURE_NAME = "Signature1"
+
+
+def create_pdf_file_signature(infile):
+ pdf_signature = pdf_facades.PdfFileSignature()
+ pdf_signature.bind_pdf(infile)
+ return pdf_signature
+
+
+def create_signature_rectangle():
+ return apd.Rectangle(10, 10, 200, 60)
+
+
+def get_certificate_path(certificate_path=None):
+ if certificate_path:
+ return certificate_path
+ return path.join(path.dirname(__file__), DEFAULT_CERTIFICATE_FILENAME)
+
+
+def ensure_certificate_file(certificate_path=None):
+ resolved_path = get_certificate_path(certificate_path)
+ if not path.exists(resolved_path):
+ raise FileNotFoundError(
+ "Certificate file not found. "
+ f"Place '{DEFAULT_CERTIFICATE_FILENAME}' next to this example or pass a custom path: {resolved_path}"
+ )
+ return resolved_path
+
+
+def configure_signature_certificate(pdf_signature, certificate_path=None, certificate_password=DEFAULT_CERTIFICATE_PASSWORD):
+ resolved_path = ensure_certificate_file(certificate_path)
+ pdf_signature.set_certificate(resolved_path, certificate_password)
+ return resolved_path
+
+
+def create_pkcs7_signature(
+ certificate_path=None,
+ certificate_password=DEFAULT_CERTIFICATE_PASSWORD,
+ reason="Document approval",
+ contact_info="qa@example.com",
+ location="New York, USA",
+ authority="Aspose.PDF Example",
+):
+ resolved_path = ensure_certificate_file(certificate_path)
+ signature = ap.forms.PKCS7(resolved_path, certificate_password)
+ signature.reason = reason
+ signature.contact_info = contact_info
+ signature.location = location
+ signature.authority = authority
+ return signature
+
+
+def create_custom_signature_appearance():
+ appearance = ap.forms.SignatureCustomAppearance()
+ appearance.font_family_name = "Arial"
+ appearance.font_size = 10
+ appearance.show_contact_info = True
+ appearance.show_location = True
+ appearance.show_reason = True
+ return appearance
+
+
+def create_doc_mdp_signature(
+ access_permissions,
+ certificate_path=None,
+ certificate_password=DEFAULT_CERTIFICATE_PASSWORD,
+ reason="Document certification",
+ contact_info="security@example.com",
+ location="New York, USA",
+):
+ signature = create_pkcs7_signature(
+ certificate_path=certificate_path,
+ certificate_password=certificate_password,
+ reason=reason,
+ contact_info=contact_info,
+ location=location,
+ authority="Aspose.PDF Certification Example",
+ )
+ return ap.forms.DocMDPSignature(signature, access_permissions)
+
+
+def list_signature_names(pdf_signature, only_active=False):
+ names = pdf_signature.get_sign_names(only_active)
+ if names is None:
+ return []
+ return [str(name) for name in names]
+
+
+def require_signature_name(pdf_signature, sign_name=None, only_active=False):
+ if sign_name:
+ return sign_name
+
+ names = list_signature_names(pdf_signature, only_active=only_active)
+ if not names:
+ raise ValueError("No signatures were found in the input PDF.")
+ return names[0]
+
+
+def write_stream_data(stream_data, outfile):
+ if stream_data is None:
+ raise ValueError("The API returned no stream data to write.")
+
+ if isinstance(stream_data, (bytes, bytearray)):
+ payload = bytes(stream_data)
+ elif hasattr(stream_data, "to_array"):
+ payload = bytes(stream_data.to_array())
+ elif hasattr(stream_data, "read"):
+ try:
+ payload = stream_data.read()
+ except TypeError:
+ payload = bytes(stream_data)
+ else:
+ payload = bytes(stream_data)
+
+ output_dir = path.dirname(outfile)
+ if output_dir:
+ os.makedirs(output_dir, exist_ok=True)
+
+ with open(outfile, "wb") as output_file:
+ output_file.write(payload)
diff --git a/examples/facades/pdf_file_signature/certificate.pfx b/examples/facades/pdf_file_signature/certificate.pfx
new file mode 100644
index 0000000..7864329
Binary files /dev/null and b/examples/facades/pdf_file_signature/certificate.pfx differ
diff --git a/examples/facades/pdf_file_signature/pdf-certification.py b/examples/facades/pdf_file_signature/pdf-certification.py
new file mode 100644
index 0000000..050e152
--- /dev/null
+++ b/examples/facades/pdf_file_signature/pdf-certification.py
@@ -0,0 +1,101 @@
+import aspose.pdf as ap
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_INPUT_PDF,
+ DEFAULT_CERTIFICATE_PASSWORD,
+ configure_signature_certificate,
+ create_pdf_file_signature,
+ create_doc_mdp_signature,
+ create_pdf_file_signature,
+ create_signature_rectangle,
+)
+
+def set_certificate_for_signing(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ certificate_path = configure_signature_certificate(
+ pdf_signature,
+ certificate_password=DEFAULT_CERTIFICATE_PASSWORD,
+ )
+ print(f"Certificate configured for signing: {certificate_path}")
+ finally:
+ pdf_signature.close()
+
+
+
+def certify_pdf_with_mdp_signature(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ doc_mdp_signature = create_doc_mdp_signature(
+ ap.forms.DocMDPAccessPermissions.FILLING_IN_FORMS,
+ reason="Certified for form filling and signing",
+ )
+ pdf_signature.certify(
+ 1,
+ "Certified for form filling and signing",
+ "security@example.com",
+ "New York, USA",
+ True,
+ create_signature_rectangle(),
+ doc_mdp_signature,
+ )
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def apply_document_level_certification(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ doc_mdp_signature = create_doc_mdp_signature(
+ ap.forms.DocMDPAccessPermissions.NO_CHANGES,
+ reason="Certified with no further changes allowed",
+ )
+ pdf_signature.certify(
+ 1,
+ "Certified with no further changes allowed",
+ "security@example.com",
+ "New York, USA",
+ True,
+ create_signature_rectangle(),
+ doc_mdp_signature,
+ )
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF certification examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Set Certificate for Signing", set_certificate_for_signing),
+ ("Certify PDF with MDP Signature", certify_pdf_with_mdp_signature),
+ ("Apply Document-Level Certification", apply_document_level_certification),
+ ]
+
+ for name, func in examples:
+ try:
+ func(
+ path.join(input_dir, DEFAULT_INPUT_PDF),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/pdf-signing.py b/examples/facades/pdf_file_signature/pdf-signing.py
new file mode 100644
index 0000000..47fc873
--- /dev/null
+++ b/examples/facades/pdf_file_signature/pdf-signing.py
@@ -0,0 +1,119 @@
+import aspose.pdf.facades as pdf_facades
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_INPUT_PDF,
+ DEFAULT_SIGNATURE_NAME,
+ configure_signature_certificate,
+ create_custom_signature_appearance,
+ create_pdf_file_signature,
+ create_pkcs7_signature,
+ create_signature_rectangle,
+)
+
+
+def sign_pdf_with_basic_parameters(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ configure_signature_certificate(pdf_signature)
+ pdf_signature.sign(
+ 1,
+ "Document approval",
+ "qa@example.com",
+ "New York, USA",
+ False,
+ create_signature_rectangle(),
+ )
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def sign_pdf_with_certificate_object(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ signature = create_pkcs7_signature()
+ pdf_signature.sign(1, False, create_signature_rectangle(), signature)
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def sign_pdf_with_named_signature(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ signature = create_pkcs7_signature(reason="Approved by signing workflow")
+ pdf_signature.sign(
+ 1,
+ DEFAULT_SIGNATURE_NAME,
+ "Approved by signing workflow",
+ "qa@example.com",
+ "New York, USA",
+ True,
+ create_signature_rectangle(),
+ signature,
+ )
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def apply_visible_signature(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ signature = create_pkcs7_signature(reason="Visible approval signature")
+ signature.custom_appearance = create_custom_signature_appearance()
+ pdf_signature.sign(
+ 1,
+ "Visible approval signature",
+ "qa@example.com",
+ "New York, USA",
+ True,
+ create_signature_rectangle(),
+ signature,
+ )
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF signing examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Sign PDF with Basic Parameters", sign_pdf_with_basic_parameters),
+ ("Sign PDF with Certificate Object", sign_pdf_with_certificate_object),
+ ("Sign PDF with Named Signature", sign_pdf_with_named_signature),
+ ("Apply Visible Signature", apply_visible_signature),
+ ]
+
+ for name, func in examples:
+ try:
+ if (func.__name__ == "sign_pdf_with_named_signature"):
+ func(
+ path.join(input_dir, "sample_field.pdf"),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ else:
+ func(
+ path.join(input_dir, DEFAULT_INPUT_PDF),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/revision-permissions.py b/examples/facades/pdf_file_signature/revision-permissions.py
new file mode 100644
index 0000000..63c4ee7
--- /dev/null
+++ b/examples/facades/pdf_file_signature/revision-permissions.py
@@ -0,0 +1,68 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_CERTIFIED_PDF,
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ require_signature_name,
+)
+
+
+def get_signature_revision(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signature_revision = pdf_signature.get_revision(sign_name)
+ print(f"Signature Revision for '{sign_name}': {signature_revision}")
+ finally:
+ pdf_signature.close()
+
+
+def get_total_document_revisions(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ total_revisions = pdf_signature.get_total_revision()
+ print(f"Total Document Revisions: {total_revisions}")
+ finally:
+ pdf_signature.close()
+
+
+def get_access_permissions(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ access_permissions = pdf_signature.get_access_permissions()
+ print(f"Access Permissions: {access_permissions}")
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all PDF revision and permissions examples and report status."""
+ set_license(license_path)
+ input_dir, _ = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get Signature Revision", get_signature_revision, DEFAULT_SIGNED_PDF),
+ ("Get Total Document Revisions", get_total_document_revisions, DEFAULT_SIGNED_PDF),
+ ("Get Access Permissions", get_access_permissions, DEFAULT_CERTIFIED_PDF),
+ ]
+
+ for name, func, input_name in examples:
+ try:
+ func(path.join(input_dir, input_name))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/signature-extraction.py b/examples/facades/pdf_file_signature/signature-extraction.py
new file mode 100644
index 0000000..4de9265
--- /dev/null
+++ b/examples/facades/pdf_file_signature/signature-extraction.py
@@ -0,0 +1,62 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ require_signature_name,
+ write_stream_data,
+)
+
+
+def extract_signature_image(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signature_image = pdf_signature.extract_image(sign_name)
+ write_stream_data(signature_image, outfile)
+ finally:
+ pdf_signature.close()
+
+
+def extract_signature_certificate(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signature_certificate = pdf_signature.extract_certificate(sign_name)
+ write_stream_data(signature_certificate, outfile)
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all signature extraction examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Extract Signature Image", extract_signature_image, "signature-image.bin"),
+ ("Extract Signature Certificate", extract_signature_certificate, "signature-certificate.cer"),
+ ]
+
+ for name, func, output_name in examples:
+ try:
+ func(
+ path.join(input_dir, DEFAULT_SIGNED_PDF),
+ path.join(output_dir, output_name),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/signature-information.py b/examples/facades/pdf_file_signature/signature-information.py
new file mode 100644
index 0000000..b917148
--- /dev/null
+++ b/examples/facades/pdf_file_signature/signature-information.py
@@ -0,0 +1,88 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ list_signature_names,
+ require_signature_name,
+)
+
+
+def get_signature_names(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ signature_names = list_signature_names(pdf_signature)
+ print(f"Signature Names: {signature_names}")
+ finally:
+ pdf_signature.close()
+
+
+def get_signer_details(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signer_name = pdf_signature.get_signer_name(sign_name)
+ contact_info = pdf_signature.get_contact_info(sign_name)
+ print(
+ f"Signer Details for '{sign_name}': "
+ f"signer_name={signer_name}, contact_info={contact_info}"
+ )
+ finally:
+ pdf_signature.close()
+
+
+def get_signature_date_and_time(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signature_date = pdf_signature.get_date_time(sign_name)
+ print(f"Signature Date and Time for '{sign_name}': {signature_date}")
+ finally:
+ pdf_signature.close()
+
+
+def get_signature_reason_and_location(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ signature_reason = pdf_signature.get_reason(sign_name)
+ signature_location = pdf_signature.get_location(sign_name)
+ print(
+ f"Signature Reason and Location for '{sign_name}': "
+ f"reason={signature_reason}, location={signature_location}"
+ )
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all signature information examples and report status."""
+ set_license(license_path)
+ input_dir, _ = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Get Signature Names", get_signature_names),
+ ("Get Signer Details", get_signer_details),
+ ("Get Signature Date and Time", get_signature_date_and_time),
+ ("Get Signature Reason and Location", get_signature_reason_and_location),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, DEFAULT_SIGNED_PDF))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/signature-integrity-checks.py b/examples/facades/pdf_file_signature/signature-integrity-checks.py
new file mode 100644
index 0000000..8827ce4
--- /dev/null
+++ b/examples/facades/pdf_file_signature/signature-integrity-checks.py
@@ -0,0 +1,58 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ require_signature_name,
+)
+
+
+def check_signature_coverage(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ covers_document = pdf_signature.covers_whole_document(sign_name)
+ print(f"Signature '{sign_name}' covers the whole document: {covers_document}")
+ finally:
+ pdf_signature.close()
+
+
+def validate_document_integrity(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ is_valid = pdf_signature.verify_signed(sign_name)
+ print(f"Document integrity for '{sign_name}' is valid: {is_valid}")
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all signature integrity check examples and report status."""
+ set_license(license_path)
+ input_dir, _ = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Check Signature Coverage", check_signature_coverage),
+ ("Validate Document Integrity", validate_document_integrity),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, DEFAULT_SIGNED_PDF))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/signature-management.py b/examples/facades/pdf_file_signature/signature-management.py
new file mode 100644
index 0000000..41acd70
--- /dev/null
+++ b/examples/facades/pdf_file_signature/signature-management.py
@@ -0,0 +1,61 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ require_signature_name,
+)
+
+
+def remove_signature_from_pdf(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ pdf_signature.remove_signature(sign_name)
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def remove_signature_with_field_cleanup(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ pdf_signature.remove_signature(sign_name, True)
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all signature management examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Remove Signature from PDF", remove_signature_from_pdf),
+ ("Remove Signature with Field Cleanup", remove_signature_with_field_cleanup),
+ ]
+
+ for name, func in examples:
+ try:
+ func(
+ path.join(input_dir, DEFAULT_SIGNED_PDF),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/signature-verification.py b/examples/facades/pdf_file_signature/signature-verification.py
new file mode 100644
index 0000000..931fcbe
--- /dev/null
+++ b/examples/facades/pdf_file_signature/signature-verification.py
@@ -0,0 +1,57 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+ require_signature_name,
+)
+
+
+def verify_pdf_signature(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ sign_name = require_signature_name(pdf_signature)
+ is_valid = pdf_signature.verify_signature(sign_name)
+ print(f"Signature '{sign_name}' is valid: {is_valid}")
+ finally:
+ pdf_signature.close()
+
+
+def check_if_pdf_contains_signatures(infile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ contains_signatures = pdf_signature.contains_signature()
+ print(f"PDF contains signatures: {contains_signatures}")
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all signature verification examples and report status."""
+ set_license(license_path)
+ input_dir, _ = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Verify PDF Signature", verify_pdf_signature),
+ ("Check if PDF Contains Signatures", check_if_pdf_contains_signatures),
+ ]
+
+ for name, func in examples:
+ try:
+ func(path.join(input_dir, DEFAULT_SIGNED_PDF))
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_signature/usage-rights-management.py b/examples/facades/pdf_file_signature/usage-rights-management.py
new file mode 100644
index 0000000..c2e3af1
--- /dev/null
+++ b/examples/facades/pdf_file_signature/usage-rights-management.py
@@ -0,0 +1,50 @@
+import sys
+from os import path
+
+# Ensure "examples/config.py" is importable from nested folders like examples/facades/form
+CURRENT_DIR = path.dirname(__file__)
+EXAMPLES_DIR = path.abspath(path.join(CURRENT_DIR, "..", ".."))
+if EXAMPLES_DIR not in sys.path:
+ sys.path.insert(0, EXAMPLES_DIR)
+
+from config import initialize_data_dir, set_license
+
+from _pdf_file_signature_helpers import (
+ DEFAULT_SIGNED_PDF,
+ create_pdf_file_signature,
+)
+
+
+def remove_usage_rights(infile, outfile):
+ pdf_signature = create_pdf_file_signature(infile)
+ try:
+ had_usage_rights = pdf_signature.contains_usage_rights()
+ print(f"PDF contains usage rights before removal: {had_usage_rights}")
+ pdf_signature.remove_usage_rights()
+ pdf_signature.save(outfile)
+ finally:
+ pdf_signature.close()
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ """Run all usage rights management examples and report status."""
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ ("Remove Usage Rights", remove_usage_rights),
+ ]
+
+ for name, func in examples:
+ try:
+ func(
+ path.join(input_dir, DEFAULT_SIGNED_PDF),
+ path.join(output_dir, f"{func.__name__}.pdf"),
+ )
+ print(f"✅ Success: {name}")
+ except Exception as e:
+ print(f"❌ Failed {name} - {e}")
+
+
+if __name__ == "__main__":
+ run_all_examples()
diff --git a/examples/facades/pdf_file_stamp/add-pdf-page-stamp_1.py b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_1.py
new file mode 100644
index 0000000..6f7a208
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_1.py
@@ -0,0 +1,35 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-pdf-page-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp, Stamp
+
+def add_page_stamp_on_all_pages():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "SourcePDF.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Bind PDF page to be used as stamp (page 1)
+ stamp.bind_pdf(data_dir + "AddPageStampOnAllPages.pdf", 1)
+
+ # Set stamp position and appearance
+ stamp.set_origin(20, 20)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # Add stamp to all pages
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "PageStampOnAllPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-pdf-page-stamp_2.py b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_2.py
new file mode 100644
index 0000000..f25991e
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_2.py
@@ -0,0 +1,38 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-pdf-page-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp, Stamp
+
+def add_page_stamp_on_certain_pages():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "SourcePDF.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Bind PDF page to be used as stamp (page 1)
+ stamp.bind_pdf(data_dir + "PageStampOnCertainPages.pdf", 1)
+
+ # Configure stamp properties
+ stamp.set_origin(20, 20)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # Apply stamp only to selected pages (1 and 3)
+ stamp.pages = [1, 3]
+
+ # Add stamp to the PDF
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "PageStampOnCertainPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-pdf-page-stamp_3.py b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_3.py
new file mode 100644
index 0000000..9eb6331
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_3.py
@@ -0,0 +1,56 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-pdf-page-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ PdfFileInfo,
+ FormattedText,
+ FontStyle,
+ EncodingType
+)
+from aspose.pdf.facades import PageNumPosition
+from System.Drawing import Color
+
+def add_page_number_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ input_pdf = data_dir + "StampPDF.pdf"
+ output_pdf = data_dir + "AddPageNumber_out.pdf"
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind PDF document
+ file_stamp.bind_pdf(input_pdf)
+
+ # Get total number of pages
+ pdf_info = PdfFileInfo(input_pdf)
+ total_pages = pdf_info.number_of_pages
+
+ # Create formatted text for page number ("#" is replaced by current page number)
+ formatted_text = FormattedText(
+ f"Page # of {total_pages}",
+ Color.AntiqueWhite,
+ Color.Gray,
+ FontStyle.times_bold_italic,
+ EncodingType.winansi,
+ False,
+ 12
+ )
+
+ # Set starting page number
+ file_stamp.starting_number = 1
+
+ # Add page number at upper-right position
+ file_stamp.add_page_number(
+ formatted_text,
+ PageNumPosition.pos_upper_right
+ )
+
+ # Save output PDF
+ file_stamp.save(output_pdf)
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-pdf-page-stamp_4.py b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_4.py
new file mode 100644
index 0000000..7e7b5f0
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-pdf-page-stamp_4.py
@@ -0,0 +1,61 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-pdf-page-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ PdfFileInfo,
+ FormattedText,
+ FontStyle,
+ EncodingType,
+ PageNumPosition
+)
+from aspose.pdf import NumberingStyle
+from System.Drawing import Color
+
+def add_custom_page_number_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ input_pdf = data_dir + "StampPDF.pdf"
+ output_pdf = data_dir + "AddCustomPageNumber_out.pdf"
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind PDF document
+ file_stamp.bind_pdf(input_pdf)
+
+ # Get total number of pages
+ pdf_info = PdfFileInfo(input_pdf)
+ total_pages = pdf_info.number_of_pages
+
+ # Create formatted text for page number
+ # "#" will be replaced by the current page number
+ formatted_text = FormattedText(
+ f"Page # of {total_pages}",
+ Color.AntiqueWhite,
+ Color.Gray,
+ FontStyle.times_bold_italic,
+ EncodingType.winansi,
+ False,
+ 12
+ )
+
+ # Specify numbering style (Roman numerals, uppercase)
+ file_stamp.numbering_style = NumberingStyle.numerals_roman_uppercase
+
+ # Set starting page number
+ file_stamp.starting_number = 1
+
+ # Add page number in the upper-right corner
+ file_stamp.add_page_number(
+ formatted_text,
+ PageNumPosition.pos_upper_right
+ )
+
+ # Save output PDF
+ file_stamp.save(output_pdf)
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-text-and-image-stamp_1.py b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_1.py
new file mode 100644
index 0000000..b743402
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_1.py
@@ -0,0 +1,51 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-text-and-image-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ Stamp,
+ FormattedText,
+ FontStyle,
+ EncodingType
+)
+from System.Drawing import Color
+
+def add_text_stamp_on_all_pages_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Create formatted text and bind it as a logo (text stamp)
+ text = FormattedText(
+ "Hello World!",
+ Color.Blue,
+ Color.Gray,
+ FontStyle.helvetica,
+ EncodingType.winansi,
+ True,
+ 14
+ )
+ stamp.bind_logo(text)
+
+ # Configure stamp properties
+ stamp.set_origin(10, 400)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # Add stamp to all pages
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddTextStampOnAllPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-text-and-image-stamp_2.py b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_2.py
new file mode 100644
index 0000000..75eda6b
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_2.py
@@ -0,0 +1,54 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-text-and-image-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ Stamp,
+ FormattedText,
+ FontStyle,
+ EncodingType
+)
+from System.Drawing import Color
+
+def add_text_stamp_on_particular_pages_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Create formatted text and bind it as a logo (text stamp)
+ text = FormattedText(
+ "Hello World!",
+ Color.Blue,
+ Color.Gray,
+ FontStyle.helvetica,
+ EncodingType.winansi,
+ True,
+ 14
+ )
+ stamp.bind_logo(text)
+
+ # Configure stamp properties
+ stamp.set_origin(10, 400)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # Apply stamp only to selected pages (page 2)
+ stamp.pages = [2]
+
+ # Add stamp to the PDF
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddTextStampOnParticularPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-text-and-image-stamp_3.py b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_3.py
new file mode 100644
index 0000000..ae4d902
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_3.py
@@ -0,0 +1,39 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-text-and-image-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp, Stamp
+
+def add_image_stamp_on_all_pages_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Bind image to stamp
+ stamp.bind_image(data_dir + "StampImage.png")
+
+ # Configure stamp properties
+ stamp.set_origin(10, 200)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # OPTIONAL:
+ # If you want to apply the stamp only to selected pages, uncomment below
+ # stamp.pages = [2]
+
+ # Add stamp to PDF file (applies to all pages by default)
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddImageStampOnAllPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/add-text-and-image-stamp_4.py b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_4.py
new file mode 100644
index 0000000..af37c23
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/add-text-and-image-stamp_4.py
@@ -0,0 +1,38 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\add-text-and-image-stamp
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp, Stamp
+
+def add_image_stamp_on_particular_pages_in_pdf_file():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ # Create PdfFileStamp object
+ file_stamp = PdfFileStamp()
+
+ # Bind source PDF document
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create stamp object
+ stamp = Stamp()
+
+ # Bind image to stamp
+ stamp.bind_image(data_dir + "StampImage.png")
+
+ # Configure stamp properties
+ stamp.set_origin(10, 200)
+ stamp.rotation = 90.0
+ stamp.is_background = True
+
+ # Apply stamp only to selected pages (e.g., page 2)
+ stamp.pages = [2]
+
+ # Add stamp to PDF file
+ file_stamp.add_stamp(stamp)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddImageStampOnParticularPages_out.pdf")
+
+ # Close the stamp object
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/manage-header-and-footer_1.py b/examples/facades/pdf_file_stamp/manage-header-and-footer_1.py
new file mode 100644
index 0000000..f173841
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/manage-header-and-footer_1.py
@@ -0,0 +1,36 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\manage-header-and-footer
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ FormattedText,
+ FontStyle,
+ EncodingType
+)
+from System.Drawing import Color
+
+def add_header():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ file_stamp = PdfFileStamp()
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create formatted text for header
+ header_text = FormattedText(
+ "Aspose - Your File Format Experts!",
+ Color.Yellow,
+ Color.Black,
+ FontStyle.courier,
+ EncodingType.winansi,
+ False,
+ 14
+ )
+
+ # Add header with top margin
+ file_stamp.add_header(header_text, 10)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddHeader_out.pdf")
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/manage-header-and-footer_2.py b/examples/facades/pdf_file_stamp/manage-header-and-footer_2.py
new file mode 100644
index 0000000..09a0657
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/manage-header-and-footer_2.py
@@ -0,0 +1,36 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\manage-header-and-footer
+# Code fence language: python
+
+
+from aspose.pdf.facades import (
+ PdfFileStamp,
+ FormattedText,
+ FontStyle,
+ EncodingType
+)
+from System.Drawing import Color
+
+def add_footer():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ file_stamp = PdfFileStamp()
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Create formatted text for footer
+ footer_text = FormattedText(
+ "Aspose - Your File Format Experts!",
+ Color.Blue,
+ Color.Gray,
+ FontStyle.courier,
+ EncodingType.winansi,
+ False,
+ 14
+ )
+
+ # Add footer with bottom margin
+ file_stamp.add_footer(footer_text, 10)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddFooter_out.pdf")
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/manage-header-and-footer_3.py b/examples/facades/pdf_file_stamp/manage-header-and-footer_3.py
new file mode 100644
index 0000000..7a13695
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/manage-header-and-footer_3.py
@@ -0,0 +1,20 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\manage-header-and-footer
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp
+
+def add_image_header():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ file_stamp = PdfFileStamp()
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Open image stream and add as header
+ with open(data_dir + "ImageHeader.png", "rb") as image_stream:
+ file_stamp.add_header(image_stream, 10)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddImageHeader_out.pdf")
+ file_stamp.close()
diff --git a/examples/facades/pdf_file_stamp/manage-header-and-footer_4.py b/examples/facades/pdf_file_stamp/manage-header-and-footer_4.py
new file mode 100644
index 0000000..442efa0
--- /dev/null
+++ b/examples/facades/pdf_file_stamp/manage-header-and-footer_4.py
@@ -0,0 +1,20 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdffilestamp\manage-header-and-footer
+# Code fence language: python
+
+
+from aspose.pdf.facades import PdfFileStamp
+
+def add_image_footer():
+ data_dir = RunExamples.get_data_dir_aspose_pdf_images()
+
+ file_stamp = PdfFileStamp()
+ file_stamp.bind_pdf(data_dir + "sample.pdf")
+
+ # Open image stream and add as footer
+ with open(data_dir + "ImageFooter.png", "rb") as image_stream:
+ file_stamp.add_footer(image_stream, 10)
+
+ # Save output PDF
+ file_stamp.save(data_dir + "AddImageFooter_out.pdf")
+ file_stamp.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_1.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_1.py
new file mode 100644
index 0000000..3f673b8
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_1.py
@@ -0,0 +1,33 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+# Prepare viewer
+viewer = pdf.facades.PdfViewer()
+
+# Bind the PDF (open)
+viewer.bind_pdf("PrintDocument.pdf")
+
+# Adjust settings
+viewer.auto_resize = True
+viewer.auto_rotate = True
+viewer.print_page_dialog = False
+
+# Create printer and page settings
+ps = pdf.printing.PrinterSettings()
+pgs = pdf.printing.PageSettings()
+
+# You can explicitly specify printer name (optional)
+# ps.printer_name = "Your Printer Name"
+
+# Example: Set A4 page size
+pgs.paper_size = pdf.printing.PaperSizes.A4
+
+# Print
+viewer.print_document_with_settings(pgs, ps)
+
+# Release resources
+viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_2.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_2.py
new file mode 100644
index 0000000..83a1125
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_2.py
@@ -0,0 +1,43 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+import System
+from System.Windows.Forms import PrintDialog, DialogResult
+
+def printing_pdf_display_print_dialog():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+
+ # Create PdfViewer object
+ viewer = pdf.facades.PdfViewer()
+
+ try:
+ # Bind PDF document
+ viewer.bind_pdf(data_dir + "PrintDocument.pdf")
+
+ # Set attributes for printing
+ viewer.auto_resize = True
+ viewer.auto_rotate = True
+
+ # Show system print dialog
+ print_dialog = PrintDialog()
+
+ if print_dialog.ShowDialog() == DialogResult.OK:
+ # Convert .NET PrinterSettings to Aspose equivalents
+ ps = pdf.printing.PrinterSettings.to_aspose_printer_settings(
+ print_dialog.PrinterSettings
+ )
+
+ pgs = pdf.printing.PageSettings.to_aspose_page_settings(
+ print_dialog.PrinterSettings.DefaultPageSettings
+ )
+
+ # Print document using selected printer and page settings
+ viewer.print_document_with_settings(pgs, ps)
+
+ finally:
+ # Release resources
+ viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_3.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_3.py
new file mode 100644
index 0000000..2c3da36
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_3.py
@@ -0,0 +1,26 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+viewer = pdf.facades.PdfViewer()
+viewer.bind_pdf("PrintDocument.pdf")
+
+viewer.auto_resize = True
+viewer.auto_rotate = True
+viewer.print_page_dialog = False
+
+ps = pdf.printing.PrinterSettings()
+pgs = pdf.printing.PageSettings()
+
+# Set soft printer and print to file
+ps.printer_name = "Adobe PDF" # Or another virtual printer
+ps.print_file_name = "OutFile.pdf"
+ps.print_to_file = True
+
+pgs.paper_size = pdf.printing.PaperSizes.A4
+
+viewer.print_document_with_settings(pgs, ps)
+viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_4.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_4.py
new file mode 100644
index 0000000..a6d4ded
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_4.py
@@ -0,0 +1,22 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+viewer = pdf.facades.PdfViewer()
+viewer.bind_pdf("PrintDocument.pdf")
+
+viewer.auto_resize = True
+viewer.auto_rotate = True
+viewer.print_page_dialog = False
+viewer.print_as_grayscale = True # Print in grayscale
+
+ps = pdf.printing.PrinterSettings()
+pgs = pdf.printing.PageSettings()
+ps.printer_name = "Microsoft XPS Document Writer"
+pgs.paper_size = pdf.printing.PaperSizes.A4
+
+viewer.print_document_with_settings(pgs, ps)
+viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_5.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_5.py
new file mode 100644
index 0000000..9574d0f
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_5.py
@@ -0,0 +1,45 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+def printing_pdf_hide_print_dialog():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+
+ # Create PdfViewer object
+ viewer = pdf.facades.PdfViewer()
+
+ try:
+ # Bind PDF document
+ viewer.bind_pdf(data_dir + "PrintDocument.pdf")
+
+ # Set attributes for printing
+ # Print the file with adjusted size
+ viewer.auto_resize = True
+ # Print the file with adjusted rotation
+ viewer.auto_rotate = True
+ # Do not show the page number dialog
+ viewer.print_page_dialog = False
+
+ # Create printer and page settings
+ ps = pdf.printing.PrinterSettings()
+ pgs = pdf.printing.PageSettings()
+
+ # Set XPS/PDF printer name
+ ps.printer_name = "OneNote for Windows 10"
+
+ # Set page size (A4)
+ pgs.paper_size = pdf.printing.PaperSizes.A4
+
+ # Set page margins (left, right, top, bottom)
+ pgs.margins = pdf.devices.Margins(0, 0, 0, 0)
+
+ # Print document using printer and page settings
+ viewer.print_document_with_settings(pgs, ps)
+
+ finally:
+ # Close viewer and release resources
+ viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_6.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_6.py
new file mode 100644
index 0000000..25e34de
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_6.py
@@ -0,0 +1,47 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+def printing_pdf_to_postscript():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+
+ # Create PdfViewer object
+ viewer = pdf.facades.PdfViewer()
+
+ try:
+ # Bind PDF document
+ viewer.bind_pdf(data_dir + "PrintDocument.pdf")
+
+ # Set attributes for printing
+ viewer.auto_resize = True
+ viewer.auto_rotate = True
+ viewer.print_page_dialog = False
+ viewer.print_as_image = False # Do NOT convert pages to images
+
+ # Create printer and page settings
+ ps = pdf.printing.PrinterSettings()
+ pgs = pdf.printing.PageSettings()
+
+ # Set PostScript printer name
+ ps.printer_name = "HP Universal Printing PS (v7.0.0)"
+
+ # Set output file and enable PrintToFile
+ ps.print_file_name = data_dir + "PdfToPostScript_out.ps"
+ ps.print_to_file = True
+
+ # Set page size (A4)
+ pgs.paper_size = pdf.printing.PaperSizes.A4
+
+ # Set page margins (left, right, top, bottom)
+ pgs.margins = pdf.devices.Margins(0, 0, 0, 0)
+
+ # Print document using printer and page settings
+ viewer.print_document_with_settings(pgs, ps)
+
+ finally:
+ # Release resources
+ viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_7.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_7.py
new file mode 100644
index 0000000..cea4edf
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_7.py
@@ -0,0 +1,55 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+def checking_print_job_status():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+
+ # Instantiate PdfViewer object
+ viewer = pdf.facades.PdfViewer()
+
+ try:
+ # Bind PDF document
+ viewer.bind_pdf(data_dir + "PrintDocument.pdf")
+
+ # Set attributes for printing
+ viewer.auto_resize = True
+ viewer.auto_rotate = True
+ viewer.print_page_dialog = False
+ viewer.print_as_image = False
+
+ # Create printer and page settings
+ ps = pdf.printing.PrinterSettings()
+ pgs = pdf.printing.PageSettings()
+
+ # Specify the printer name
+ ps.printer_name = "Microsoft XPS Document Writer"
+
+ # Set output file name and enable PrintToFile
+ ps.print_file_name = data_dir + "CheckingPrintJobStatus_out.xps"
+ ps.print_to_file = True
+
+ # Set page size (A4)
+ pgs.paper_size = pdf.printing.PaperSizes.A4
+
+ # Set page margins
+ pgs.margins = pdf.devices.Margins(0, 0, 0, 0)
+
+ # Print document using printer and page settings
+ viewer.print_document_with_settings(pgs, ps)
+
+ # Check the print status
+ if viewer.print_status is not None:
+ # An exception was thrown during printing
+ print(str(viewer.print_status))
+ else:
+ # Printing completed successfully
+ print("Printing completed without any issue.")
+
+ finally:
+ # Release resources
+ viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_8.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_8.py
new file mode 100644
index 0000000..e17a66f
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_8.py
@@ -0,0 +1,108 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+import os
+
+class PrintingJobSettings:
+ def __init__(self, from_page, to_page, output_file, duplex_mode):
+ self.from_page = from_page
+ self.to_page = to_page
+ self.output_file = output_file
+ self.mode = duplex_mode
+
+
+def printing_pages_in_simplex_and_duplex_mode():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+ output_dir = data_dir
+
+ printing_job_index = 0
+ printing_jobs = []
+
+ # Create printing jobs
+ printing_jobs.append(
+ PrintingJobSettings(
+ from_page=1,
+ to_page=3,
+ output_file=output_dir + "PrintPageRange_p1-3_out.xps",
+ duplex_mode=pdf.printing.Duplex.Default
+ )
+ )
+
+ printing_jobs.append(
+ PrintingJobSettings(
+ from_page=4,
+ to_page=6,
+ output_file=output_dir + "PrintPageRange_p4-6_out.xps",
+ duplex_mode=pdf.printing.Duplex.Simplex
+ )
+ )
+
+ printing_jobs.append(
+ PrintingJobSettings(
+ from_page=7,
+ to_page=7,
+ output_file=output_dir + "PrintPageRange_p7_out.xps",
+ duplex_mode=pdf.printing.Duplex.Default
+ )
+ )
+
+ # Create PdfViewer object
+ viewer = pdf.facades.PdfViewer()
+
+ try:
+ # Bind PDF document
+ viewer.bind_pdf(data_dir + "Print-PageRange.pdf")
+
+ # Set printing attributes
+ viewer.auto_resize = True
+ viewer.auto_rotate = True
+ viewer.print_page_dialog = False
+
+ # Create printer and page settings
+ ps = pdf.printing.PrinterSettings()
+ pgs = pdf.printing.PageSettings()
+
+ # Set printer name
+ ps.printer_name = "Microsoft XPS Document Writer"
+
+ # Set initial job settings
+ ps.print_to_file = True
+ ps.print_range = pdf.printing.PrintRange.SomePages
+
+ # Paper size and margins
+ pgs.paper_size = pdf.printing.PaperSizes.A4
+ ps.default_page_settings.paper_size = pgs.paper_size
+ pgs.margins = pdf.devices.Margins(0, 0, 0, 0)
+
+ # Helper to apply a print job
+ def apply_print_job(index):
+ job = printing_jobs[index]
+ ps.print_file_name = os.path.abspath(job.output_file)
+ ps.from_page = job.from_page
+ ps.to_page = job.to_page
+ ps.duplex = job.mode
+
+ # Apply first job
+ apply_print_job(printing_job_index)
+
+ # EndPrint event handler (chain next jobs)
+ def on_end_print(sender, args):
+ nonlocal printing_job_index
+ printing_job_index += 1
+
+ if printing_job_index < len(printing_jobs):
+ apply_print_job(printing_job_index)
+ viewer.print_document_with_settings(pgs, ps)
+
+ viewer.end_print += on_end_print
+
+ # Start first print job
+ viewer.print_document_with_settings(pgs, ps)
+
+ finally:
+ # Release resources
+ viewer.close()
diff --git a/examples/facades/pdf_viewer/working-with-pdf-printing-facades_9.py b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_9.py
new file mode 100644
index 0000000..77a1220
--- /dev/null
+++ b/examples/facades/pdf_viewer/working-with-pdf-printing-facades_9.py
@@ -0,0 +1,37 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\pdfviewer\working-with-pdf-printing-facades
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+import os
+
+def printing_multiple_documents_in_single_job():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_printing()
+
+ # Paths to documents to be printed
+ path1 = os.path.join(data_dir, "PrintDocument.pdf")
+ path2 = os.path.join(data_dir, "Print-PageRange.pdf")
+ path3 = os.path.join(data_dir, "35925_1_3.xps")
+
+ # Create printer settings
+ printer_settings = pdf.printing.PrinterSettings()
+
+ # Use default system printer (same idea as PrintDocument.PrinterSettings.PrinterName)
+ # If you want to force a printer, uncomment and set it explicitly:
+ # printer_settings.printer_name = "Microsoft XPS Document Writer"
+
+ # Create page settings
+ page_settings = pdf.printing.PageSettings()
+ page_settings.paper_size = pdf.printing.PaperSizes.A4
+ page_settings.margins = pdf.devices.Margins(0, 0, 0, 0)
+
+ # Print multiple documents in a single print job
+ pdf.facades.PdfViewer.print_documents(
+ printer_settings,
+ page_settings,
+ path1,
+ path2,
+ path3
+ )
diff --git a/examples/facades/stamp/adding-multi-line-watermark-to-existing-pdf_1.py b/examples/facades/stamp/adding-multi-line-watermark-to-existing-pdf_1.py
new file mode 100644
index 0000000..17e479d
--- /dev/null
+++ b/examples/facades/stamp/adding-multi-line-watermark-to-existing-pdf_1.py
@@ -0,0 +1,30 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\stamp\adding-multi-line-watermark-to-existing-pdf
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+import System
+from System.Drawing import Color
+
+def add_text_stamp_to_pdf():
+ # Instantiate a Stamp object
+ logo_stamp = pdf.facades.Stamp()
+
+ # Create a FormattedText object (first line)
+ formatted_text = pdf.facades.FormattedText(
+ "Hello World!",
+ Color.FromArgb(180, 0, 0), # Semi-transparent red
+ pdf.facades.FontStyle.TimesItalic, # Font style
+ pdf.facades.EncodingType.Winansi, # Encoding
+ False, # Embedded font
+ 50 # Font size
+ )
+
+ # Add another line to the stamp
+ formatted_text.add_new_line_text("Good Luck")
+
+ # Bind formatted text to the stamp
+ logo_stamp.bind_logo(formatted_text)
+
+ return logo_stamp
diff --git a/examples/facades/stamp/rotating-stamp-about-the-center-point_1.py b/examples/facades/stamp/rotating-stamp-about-the-center-point_1.py
new file mode 100644
index 0000000..0f3d91a
--- /dev/null
+++ b/examples/facades/stamp/rotating-stamp-about-the-center-point_1.py
@@ -0,0 +1,53 @@
+# Extracted from: _index.md
+# Source folder: E:\Github\Aspose.PDF-Documentation\en\python-net\working-with-facades\stamp\rotating-stamp-about-the-center-point
+# Code fence language: python
+
+
+import aspose.pdf as pdf
+
+def add_rotating_stamp_to_pdf():
+ # Path to the documents directory
+ data_dir = RunExamples.get_data_dir_aspose_pdf_facades_technical_articles()
+
+ # PdfFileInfo is used to get page width and height
+ file_info = pdf.facades.PdfFileInfo(data_dir + "RotatingStamp.pdf")
+
+ try:
+ # Create Stamp object
+ stamp = pdf.facades.Stamp()
+
+ # Bind image to stamp
+ stamp.bind_image(data_dir + "RotatingStamp.jpg")
+
+ # Specify whether the stamp is background
+ stamp.is_background = False
+
+ # Specify pages where the stamp will be applied
+ stamp.pages = [1]
+
+ # Rotate stamp around its center (0–360 degrees)
+ stamp.rotation = 90
+
+ # Set the origin (lower-left corner of the stamp)
+ stamp.set_origin(
+ file_info.get_page_width(1) / 2,
+ file_info.get_page_height(1) / 2
+ )
+
+ # Set image size
+ stamp.set_image_size(100, 100)
+
+ # Open PDF document
+ document = pdf.Document(data_dir + "RotatingStamp_out.pdf")
+
+ try:
+ # Create PdfFileStamp to apply the stamp
+ stamper = pdf.facades.PdfFileStamp(document)
+
+ try:
+ # Add stamp to the PDF
+ stamper.add_stamp(stamp)
+ finally:
+ stamper.close()
+ document.close()
+ file_info.close()
diff --git a/examples/working_with_documents/example_formatting_pdf_document.py b/examples/working_with_documents/example_formatting_pdf_document.py
index 83482d5..d852e2e 100644
--- a/examples/working_with_documents/example_formatting_pdf_document.py
+++ b/examples/working_with_documents/example_formatting_pdf_document.py
@@ -129,7 +129,7 @@ def run_all_examples(data_dir=None, license_path=None):
("Configure document window settings", set_document_window),
("Embed fonts in existing PDF", embedded_fonts),
("Embed fonts in new PDF", embedded_fonts_in_new_document),
- ("Set default font", set_default_font),
+ ("Set default font", set_default_font),
("List document fonts", get_all_fonts),
("Improve font embedding", improve_fonts_embedding),
("Set initial zoom factor", set_zoom_factor),
diff --git a/sample_data/facades/form/input/fill_barcode_fields_in.pdf b/sample_data/facades/form/input/fill_barcode_fields_in.pdf
new file mode 100644
index 0000000..e66a5f1
Binary files /dev/null and b/sample_data/facades/form/input/fill_barcode_fields_in.pdf differ
diff --git a/sample_data/facades/form/input/fill_check_box_fields_in.pdf b/sample_data/facades/form/input/fill_check_box_fields_in.pdf
new file mode 100644
index 0000000..f25d71d
Binary files /dev/null and b/sample_data/facades/form/input/fill_check_box_fields_in.pdf differ
diff --git a/sample_data/facades/form/input/fill_fields_by_name_and_value_in.pdf b/sample_data/facades/form/input/fill_fields_by_name_and_value_in.pdf
new file mode 100644
index 0000000..9667b00
Binary files /dev/null and b/sample_data/facades/form/input/fill_fields_by_name_and_value_in.pdf differ
diff --git a/sample_data/facades/form/input/fill_list_box_fields_in.pdf b/sample_data/facades/form/input/fill_list_box_fields_in.pdf
new file mode 100644
index 0000000..81515e8
Binary files /dev/null and b/sample_data/facades/form/input/fill_list_box_fields_in.pdf differ
diff --git a/sample_data/facades/form/input/fill_radio_button_fields_in.pdf b/sample_data/facades/form/input/fill_radio_button_fields_in.pdf
new file mode 100644
index 0000000..01a8da3
Binary files /dev/null and b/sample_data/facades/form/input/fill_radio_button_fields_in.pdf differ
diff --git a/sample_data/facades/form/input/fill_text_fields_in.pdf b/sample_data/facades/form/input/fill_text_fields_in.pdf
new file mode 100644
index 0000000..b615bad
Binary files /dev/null and b/sample_data/facades/form/input/fill_text_fields_in.pdf differ
diff --git a/sample_data/facades/form/input/get_field_facades_in.pdf b/sample_data/facades/form/input/get_field_facades_in.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/form/input/get_field_facades_in.pdf differ
diff --git a/sample_data/facades/form/input/get_field_values_in.pdf b/sample_data/facades/form/input/get_field_values_in.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/form/input/get_field_values_in.pdf differ
diff --git a/sample_data/facades/form/input/get_radio_button_options_in.pdf b/sample_data/facades/form/input/get_radio_button_options_in.pdf
new file mode 100644
index 0000000..0dfb4fb
Binary files /dev/null and b/sample_data/facades/form/input/get_radio_button_options_in.pdf differ
diff --git a/sample_data/facades/form/input/get_required_field_names_in.pdf b/sample_data/facades/form/input/get_required_field_names_in.pdf
new file mode 100644
index 0000000..75d7fe9
Binary files /dev/null and b/sample_data/facades/form/input/get_required_field_names_in.pdf differ
diff --git a/sample_data/facades/form/input/get_rich_text_values_in.pdf b/sample_data/facades/form/input/get_rich_text_values_in.pdf
new file mode 100644
index 0000000..e673b1f
Binary files /dev/null and b/sample_data/facades/form/input/get_rich_text_values_in.pdf differ
diff --git a/sample_data/facades/form/input/get_rich_text_values_in_data.xml b/sample_data/facades/form/input/get_rich_text_values_in_data.xml
new file mode 100644
index 0000000..00f5ed9
--- /dev/null
+++ b/sample_data/facades/form/input/get_rich_text_values_in_data.xml
@@ -0,0 +1,12 @@
+
+YellowtownAlexanderGreenfieldAspose.PDF for Python via .NET, PDF Processing API that allows the developers to work with PDF documents without needing Microsoft Office® or Adobe Acrobat Automation.
\ No newline at end of file
diff --git a/sample_data/facades/form/input/resolve_full_field_names_in.pdf b/sample_data/facades/form/input/resolve_full_field_names_in.pdf
new file mode 100644
index 0000000..e673b1f
Binary files /dev/null and b/sample_data/facades/form/input/resolve_full_field_names_in.pdf differ
diff --git a/sample_data/facades/form/input/sample_form.fdf b/sample_data/facades/form/input/sample_form.fdf
new file mode 100644
index 0000000..ea61cbc
--- /dev/null
+++ b/sample_data/facades/form/input/sample_form.fdf
@@ -0,0 +1,7 @@
+%FDF-1.2
%
1 0 obj
+<><><><><>]/Annots[]>>>>
+endobj
+
+trailer
+<>
+%%EOF
\ No newline at end of file
diff --git a/sample_data/facades/form/input/sample_form.json b/sample_data/facades/form/input/sample_form.json
new file mode 100644
index 0000000..9ce8ee2
--- /dev/null
+++ b/sample_data/facades/form/input/sample_form.json
@@ -0,0 +1,26 @@
+[
+ {
+ "Name": "First Name",
+ "PageIndex": 1,
+ "Flags": 4,
+ "Value": "Thomas"
+ },
+ {
+ "Name": "Last Name",
+ "PageIndex": 1,
+ "Flags": 4,
+ "Value": "Jacksonn"
+ },
+ {
+ "Name": "City",
+ "PageIndex": 1,
+ "Flags": 4,
+ "Value": "Yellowville"
+ },
+ {
+ "Name": "Country",
+ "PageIndex": 1,
+ "Flags": 4,
+ "Value": "Kenya"
+ }
+]
\ No newline at end of file
diff --git a/sample_data/facades/form/input/sample_form.pdf b/sample_data/facades/form/input/sample_form.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/form/input/sample_form.pdf differ
diff --git a/sample_data/facades/form/input/sample_form.xfdf b/sample_data/facades/form/input/sample_form.xfdf
new file mode 100644
index 0000000..1fde6c6
--- /dev/null
+++ b/sample_data/facades/form/input/sample_form.xfdf
@@ -0,0 +1,17 @@
+
+
+
+
+ Alexander
+
+
+ Greenfield
+
+
+ Yellowtown
+
+
+ Redland
+
+
+
\ No newline at end of file
diff --git a/sample_data/facades/form/input/sample_form.xml b/sample_data/facades/form/input/sample_form.xml
new file mode 100644
index 0000000..4292929
--- /dev/null
+++ b/sample_data/facades/form/input/sample_form.xml
@@ -0,0 +1,15 @@
+
+
+
+ Thomas
+
+
+ Andersson
+
+
+ Seattle
+
+
+ Brownland
+
+
\ No newline at end of file
diff --git a/sample_data/facades/form/input/sample_form_image.jpg b/sample_data/facades/form/input/sample_form_image.jpg
new file mode 100644
index 0000000..6f8d5bd
Binary files /dev/null and b/sample_data/facades/form/input/sample_form_image.jpg differ
diff --git a/sample_data/facades/form/input/sample_form_image.pdf b/sample_data/facades/form/input/sample_form_image.pdf
new file mode 100644
index 0000000..3f54c2b
Binary files /dev/null and b/sample_data/facades/form/input/sample_form_image.pdf differ
diff --git a/sample_data/facades/form/input/sample_form_new.pdf b/sample_data/facades/form/input/sample_form_new.pdf
new file mode 100644
index 0000000..5d7ae0b
Binary files /dev/null and b/sample_data/facades/form/input/sample_form_new.pdf differ
diff --git a/sample_data/facades/form/input/sample_form_xfa.xml b/sample_data/facades/form/input/sample_form_xfa.xml
new file mode 100644
index 0000000..b8d1c80
--- /dev/null
+++ b/sample_data/facades/form/input/sample_form_xfa.xml
@@ -0,0 +1,60 @@
+
+
+
+
+ 123
+
+ Aspose
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+ 0.00000000
+ 0
+
+ 0.00000000
+ 0
+
+ 0.00000000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample_data/facades/form/input/sample_xfa_form.pdf b/sample_data/facades/form/input/sample_xfa_form.pdf
new file mode 100644
index 0000000..362785d
Binary files /dev/null and b/sample_data/facades/form/input/sample_xfa_form.pdf differ
diff --git a/sample_data/facades/formeditor/input/add_field_script.pdf b/sample_data/facades/formeditor/input/add_field_script.pdf
new file mode 100644
index 0000000..2ab1ade
Binary files /dev/null and b/sample_data/facades/formeditor/input/add_field_script.pdf differ
diff --git a/sample_data/facades/formeditor/input/add_list_item.pdf b/sample_data/facades/formeditor/input/add_list_item.pdf
new file mode 100644
index 0000000..e83933d
Binary files /dev/null and b/sample_data/facades/formeditor/input/add_list_item.pdf differ
diff --git a/sample_data/facades/formeditor/input/copy_inner_field.pdf b/sample_data/facades/formeditor/input/copy_inner_field.pdf
new file mode 100644
index 0000000..aacaf44
Binary files /dev/null and b/sample_data/facades/formeditor/input/copy_inner_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/copy_outer_field.pdf b/sample_data/facades/formeditor/input/copy_outer_field.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/copy_outer_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/decorate_field.pdf b/sample_data/facades/formeditor/input/decorate_field.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/decorate_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/del_list_item.pdf b/sample_data/facades/formeditor/input/del_list_item.pdf
new file mode 100644
index 0000000..c7ac38a
Binary files /dev/null and b/sample_data/facades/formeditor/input/del_list_item.pdf differ
diff --git a/sample_data/facades/formeditor/input/get_field_appearance.pdf b/sample_data/facades/formeditor/input/get_field_appearance.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/get_field_appearance.pdf differ
diff --git a/sample_data/facades/formeditor/input/move_field.pdf b/sample_data/facades/formeditor/input/move_field.pdf
new file mode 100644
index 0000000..e83933d
Binary files /dev/null and b/sample_data/facades/formeditor/input/move_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/remove_field.pdf b/sample_data/facades/formeditor/input/remove_field.pdf
new file mode 100644
index 0000000..e83933d
Binary files /dev/null and b/sample_data/facades/formeditor/input/remove_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/remove_field_script.pdf b/sample_data/facades/formeditor/input/remove_field_script.pdf
new file mode 100644
index 0000000..1f2f8d7
Binary files /dev/null and b/sample_data/facades/formeditor/input/remove_field_script.pdf differ
diff --git a/sample_data/facades/formeditor/input/rename_field.pdf b/sample_data/facades/formeditor/input/rename_field.pdf
new file mode 100644
index 0000000..e83933d
Binary files /dev/null and b/sample_data/facades/formeditor/input/rename_field.pdf differ
diff --git a/sample_data/facades/formeditor/input/sample_empty.pdf b/sample_data/facades/formeditor/input/sample_empty.pdf
new file mode 100644
index 0000000..3078c6b
Binary files /dev/null and b/sample_data/facades/formeditor/input/sample_empty.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_alignment.pdf b/sample_data/facades/formeditor/input/set_field_alignment.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_alignment.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_alignment_vertical.pdf b/sample_data/facades/formeditor/input/set_field_alignment_vertical.pdf
new file mode 100644
index 0000000..12fa7c8
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_alignment_vertical.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_appearance.pdf b/sample_data/facades/formeditor/input/set_field_appearance.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_appearance.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_attribute.pdf b/sample_data/facades/formeditor/input/set_field_attribute.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_attribute.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_comb_number.pdf b/sample_data/facades/formeditor/input/set_field_comb_number.pdf
new file mode 100644
index 0000000..42d74e0
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_comb_number.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_limit.pdf b/sample_data/facades/formeditor/input/set_field_limit.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_limit.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_field_script.pdf b/sample_data/facades/formeditor/input/set_field_script.pdf
new file mode 100644
index 0000000..2ab1ade
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_field_script.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_submit_flag.pdf b/sample_data/facades/formeditor/input/set_submit_flag.pdf
new file mode 100644
index 0000000..29f4534
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_submit_flag.pdf differ
diff --git a/sample_data/facades/formeditor/input/set_submit_url.pdf b/sample_data/facades/formeditor/input/set_submit_url.pdf
new file mode 100644
index 0000000..41d063e
Binary files /dev/null and b/sample_data/facades/formeditor/input/set_submit_url.pdf differ
diff --git a/sample_data/facades/formeditor/input/single2multiple.pdf b/sample_data/facades/formeditor/input/single2multiple.pdf
new file mode 100644
index 0000000..1cd33d9
Binary files /dev/null and b/sample_data/facades/formeditor/input/single2multiple.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/SampleAttachment.txt b/sample_data/facades/pdf_content_editor/input/SampleAttachment.txt
new file mode 100644
index 0000000..9c2dc12
--- /dev/null
+++ b/sample_data/facades/pdf_content_editor/input/SampleAttachment.txt
@@ -0,0 +1,3 @@
+# DEMO 1
+
+This is demo
\ No newline at end of file
diff --git a/sample_data/facades/pdf_content_editor/input/add_bookmark_action.pdf b/sample_data/facades/pdf_content_editor/input/add_bookmark_action.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/add_bookmark_action.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/add_document_action.pdf b/sample_data/facades/pdf_content_editor/input/add_document_action.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/add_document_action.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/change_viewer_preferences.pdf b/sample_data/facades/pdf_content_editor/input/change_viewer_preferences.pdf
new file mode 100644
index 0000000..ed3c7c5
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/change_viewer_preferences.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/delete_all_image.pdf b/sample_data/facades/pdf_content_editor/input/delete_all_image.pdf
new file mode 100644
index 0000000..f56f238
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/delete_all_image.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/delete_images.pdf b/sample_data/facades/pdf_content_editor/input/delete_images.pdf
new file mode 100644
index 0000000..331b4b5
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/delete_images.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/delete_stamp_by_index.pdf b/sample_data/facades/pdf_content_editor/input/delete_stamp_by_index.pdf
new file mode 100644
index 0000000..0a551e6
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/delete_stamp_by_index.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/get_viewer_preferences.pdf b/sample_data/facades/pdf_content_editor/input/get_viewer_preferences.pdf
new file mode 100644
index 0000000..ed3c7c5
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/get_viewer_preferences.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/list_stamps.pdf b/sample_data/facades/pdf_content_editor/input/list_stamps.pdf
new file mode 100644
index 0000000..564265e
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/list_stamps.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/manage_stamp_by_id.pdf b/sample_data/facades/pdf_content_editor/input/manage_stamp_by_id.pdf
new file mode 100644
index 0000000..30a8455
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/manage_stamp_by_id.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/remove_attachments.pdf b/sample_data/facades/pdf_content_editor/input/remove_attachments.pdf
new file mode 100644
index 0000000..858f41c
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/remove_attachments.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/remove_open_action.pdf b/sample_data/facades/pdf_content_editor/input/remove_open_action.pdf
new file mode 100644
index 0000000..1e98945
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/remove_open_action.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replace_image.pdf b/sample_data/facades/pdf_content_editor/input/replace_image.pdf
new file mode 100644
index 0000000..0c65dd9
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replace_image.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replace_text_on_page.pdf b/sample_data/facades/pdf_content_editor/input/replace_text_on_page.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replace_text_on_page.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replace_text_regex.pdf b/sample_data/facades/pdf_content_editor/input/replace_text_regex.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replace_text_regex.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replace_text_simple.pdf b/sample_data/facades/pdf_content_editor/input/replace_text_simple.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replace_text_simple.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replace_text_with_state.pdf b/sample_data/facades/pdf_content_editor/input/replace_text_with_state.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replace_text_with_state.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/replacement_image.jpg b/sample_data/facades/pdf_content_editor/input/replacement_image.jpg
new file mode 100644
index 0000000..8f6fef9
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/replacement_image.jpg differ
diff --git a/sample_data/facades/pdf_content_editor/input/sample.pdf b/sample_data/facades/pdf_content_editor/input/sample.pdf
new file mode 100644
index 0000000..1556ade
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/sample.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/sample4pages.pdf b/sample_data/facades/pdf_content_editor/input/sample4pages.pdf
new file mode 100644
index 0000000..5c63e6d
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/sample4pages.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/sample_audio.wav b/sample_data/facades/pdf_content_editor/input/sample_audio.wav
new file mode 100644
index 0000000..7b9da8c
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/sample_audio.wav differ
diff --git a/sample_data/facades/pdf_content_editor/input/sample_links.pdf b/sample_data/facades/pdf_content_editor/input/sample_links.pdf
new file mode 100644
index 0000000..e64103c
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/sample_links.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/input/sample_video.avi b/sample_data/facades/pdf_content_editor/input/sample_video.avi
new file mode 100644
index 0000000..cc5ef6a
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/sample_video.avi differ
diff --git a/sample_data/facades/pdf_content_editor/input/stamp_appearance.pdf b/sample_data/facades/pdf_content_editor/input/stamp_appearance.pdf
new file mode 100644
index 0000000..05596f4
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/input/stamp_appearance.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/output/add_attachment.pdf b/sample_data/facades/pdf_content_editor/output/add_attachment.pdf
new file mode 100644
index 0000000..523d6e6
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/output/add_attachment.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/output/add_attachment_from_path.pdf b/sample_data/facades/pdf_content_editor/output/add_attachment_from_path.pdf
new file mode 100644
index 0000000..aa65b01
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/output/add_attachment_from_path.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation.pdf b/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation.pdf
new file mode 100644
index 0000000..fed07c1
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation_from_stream.pdf b/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation_from_stream.pdf
new file mode 100644
index 0000000..8dd784e
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/output/add_file_attachment_annotation_from_stream.pdf differ
diff --git a/sample_data/facades/pdf_content_editor/output/remove_attachments.pdf b/sample_data/facades/pdf_content_editor/output/remove_attachments.pdf
new file mode 100644
index 0000000..d48cefb
Binary files /dev/null and b/sample_data/facades/pdf_content_editor/output/remove_attachments.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/add_margins_to_pdf_pages.pdf b/sample_data/facades/pdf_file_editor/input/add_margins_to_pdf_pages.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/add_margins_to_pdf_pages.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/add_page_breaks_in_pdf.pdf b/sample_data/facades/pdf_file_editor/input/add_page_breaks_in_pdf.pdf
new file mode 100644
index 0000000..ff86e88
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/add_page_breaks_in_pdf.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/append_pages_to_pdf.pdf b/sample_data/facades/pdf_file_editor/input/append_pages_to_pdf.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/append_pages_to_pdf.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/create_nup_pdf_document.pdf b/sample_data/facades/pdf_file_editor/input/create_nup_pdf_document.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/create_nup_pdf_document.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/create_pdf_booklet.pdf b/sample_data/facades/pdf_file_editor/input/create_pdf_booklet.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/create_pdf_booklet.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/delete_pages_from_pdf.pdf b/sample_data/facades/pdf_file_editor/input/delete_pages_from_pdf.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/delete_pages_from_pdf.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/extract_pages_from_pdf.pdf b/sample_data/facades/pdf_file_editor/input/extract_pages_from_pdf.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/extract_pages_from_pdf.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/form1.pdf b/sample_data/facades/pdf_file_editor/input/form1.pdf
new file mode 100644
index 0000000..f0ea16c
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/form1.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/form2.pdf b/sample_data/facades/pdf_file_editor/input/form2.pdf
new file mode 100644
index 0000000..a950773
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/form2.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/insert_pages_into_pdf.pdf b/sample_data/facades/pdf_file_editor/input/insert_pages_into_pdf.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/insert_pages_into_pdf.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/merge_1.pdf b/sample_data/facades/pdf_file_editor/input/merge_1.pdf
new file mode 100644
index 0000000..bf298b4
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/merge_1.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/merge_2.pdf b/sample_data/facades/pdf_file_editor/input/merge_2.pdf
new file mode 100644
index 0000000..c692deb
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/merge_2.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/merge_3.pdf b/sample_data/facades/pdf_file_editor/input/merge_3.pdf
new file mode 100644
index 0000000..2e30242
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/merge_3.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/merge_4.pdf b/sample_data/facades/pdf_file_editor/input/merge_4.pdf
new file mode 100644
index 0000000..a44c600
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/merge_4.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/resize_pdf_page_contents.pdf b/sample_data/facades/pdf_file_editor/input/resize_pdf_page_contents.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/resize_pdf_page_contents.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/sample_data.pdf b/sample_data/facades/pdf_file_editor/input/sample_data.pdf
new file mode 100644
index 0000000..f089e8a
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/sample_data.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/split_pdf_from_beginning.pdf b/sample_data/facades/pdf_file_editor/input/split_pdf_from_beginning.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/split_pdf_from_beginning.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/split_pdf_into_single_pages.pdf b/sample_data/facades/pdf_file_editor/input/split_pdf_into_single_pages.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/split_pdf_into_single_pages.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/split_pdf_to_end.pdf b/sample_data/facades/pdf_file_editor/input/split_pdf_to_end.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/split_pdf_to_end.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/try_create_nup_pdf_document.pdf b/sample_data/facades/pdf_file_editor/input/try_create_nup_pdf_document.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/try_create_nup_pdf_document.pdf differ
diff --git a/sample_data/facades/pdf_file_editor/input/try_create_pdf_booklet.pdf b/sample_data/facades/pdf_file_editor/input/try_create_pdf_booklet.pdf
new file mode 100644
index 0000000..a0af6e8
Binary files /dev/null and b/sample_data/facades/pdf_file_editor/input/try_create_pdf_booklet.pdf differ
diff --git a/sample_data/facades/pdf_file_info/input/sample.pdf b/sample_data/facades/pdf_file_info/input/sample.pdf
new file mode 100644
index 0000000..d3d5f4f
Binary files /dev/null and b/sample_data/facades/pdf_file_info/input/sample.pdf differ
diff --git a/sample_data/facades/pdf_file_info/input/sample2.pdf b/sample_data/facades/pdf_file_info/input/sample2.pdf
new file mode 100644
index 0000000..0256c5f
Binary files /dev/null and b/sample_data/facades/pdf_file_info/input/sample2.pdf differ
diff --git a/sample_data/facades/pdf_file_info/input/sample3.pdf b/sample_data/facades/pdf_file_info/input/sample3.pdf
new file mode 100644
index 0000000..8180b9a
Binary files /dev/null and b/sample_data/facades/pdf_file_info/input/sample3.pdf differ
diff --git a/sample_data/facades/pdf_file_security/input/encrypted.pdf b/sample_data/facades/pdf_file_security/input/encrypted.pdf
new file mode 100644
index 0000000..73e4951
Binary files /dev/null and b/sample_data/facades/pdf_file_security/input/encrypted.pdf differ
diff --git a/sample_data/facades/pdf_file_security/input/sample.pdf b/sample_data/facades/pdf_file_security/input/sample.pdf
new file mode 100644
index 0000000..462dea9
Binary files /dev/null and b/sample_data/facades/pdf_file_security/input/sample.pdf differ
diff --git a/sample_data/facades/pdf_file_security/input/secured.pdf b/sample_data/facades/pdf_file_security/input/secured.pdf
new file mode 100644
index 0000000..73e4951
Binary files /dev/null and b/sample_data/facades/pdf_file_security/input/secured.pdf differ
diff --git a/sample_data/facades/pdf_file_signature/input/certified.pdf b/sample_data/facades/pdf_file_signature/input/certified.pdf
new file mode 100644
index 0000000..ad88301
Binary files /dev/null and b/sample_data/facades/pdf_file_signature/input/certified.pdf differ
diff --git a/sample_data/facades/pdf_file_signature/input/sample.pdf b/sample_data/facades/pdf_file_signature/input/sample.pdf
new file mode 100644
index 0000000..462dea9
Binary files /dev/null and b/sample_data/facades/pdf_file_signature/input/sample.pdf differ
diff --git a/sample_data/facades/pdf_file_signature/input/sample_field.pdf b/sample_data/facades/pdf_file_signature/input/sample_field.pdf
new file mode 100644
index 0000000..a585513
Binary files /dev/null and b/sample_data/facades/pdf_file_signature/input/sample_field.pdf differ
diff --git a/sample_data/facades/pdf_file_signature/input/signed.pdf b/sample_data/facades/pdf_file_signature/input/signed.pdf
new file mode 100644
index 0000000..cf7ddc4
Binary files /dev/null and b/sample_data/facades/pdf_file_signature/input/signed.pdf differ
diff --git a/scripts/generate_example_specs.py b/scripts/generate_example_specs.py
new file mode 100644
index 0000000..ca035d6
--- /dev/null
+++ b/scripts/generate_example_specs.py
@@ -0,0 +1,157 @@
+from __future__ import annotations
+
+import ast
+import json
+from dataclasses import asdict, dataclass
+from pathlib import Path
+from typing import Iterable
+
+
+REPO_ROOT = Path(__file__).resolve().parents[1]
+EXAMPLES_ROOT = REPO_ROOT / "examples"
+OUTPUT_ROOT = REPO_ROOT / "specs" / "examples"
+
+
+@dataclass
+class ExampleSpec:
+ category: str
+ module_name: str
+ relative_path: str
+ has_run_all_examples: bool
+ uses_config_helpers: bool
+ operation_functions: list[str]
+ docstring: str
+
+
+@dataclass
+class ParseError:
+ relative_path: str
+ error: str
+
+
+def iter_example_files() -> Iterable[Path]:
+ for file_path in sorted(EXAMPLES_ROOT.rglob("*.py")):
+ if file_path.name == "config.py":
+ continue
+ yield file_path
+
+
+def parse_module(file_path: Path) -> ExampleSpec:
+ source = file_path.read_text(encoding="utf-8")
+ tree = ast.parse(source, filename=str(file_path))
+
+ functions = [
+ node.name
+ for node in tree.body
+ if isinstance(node, ast.FunctionDef)
+ ]
+ operation_functions = [name for name in functions if name != "run_all_examples"]
+
+ uses_config_helpers = False
+ for node in tree.body:
+ if isinstance(node, ast.ImportFrom) and node.module == "config":
+ imported_names = {alias.name for alias in node.names}
+ if {"set_license", "initialize_data_dir"}.issubset(imported_names):
+ uses_config_helpers = True
+ break
+
+ relative_path = file_path.relative_to(REPO_ROOT).as_posix()
+ relative_examples_path = file_path.relative_to(EXAMPLES_ROOT)
+ category = relative_examples_path.parts[0] if len(relative_examples_path.parts) > 1 else "root"
+
+ docstring = ast.get_docstring(tree) or ""
+ docstring = docstring.strip().splitlines()[0] if docstring.strip() else ""
+
+ return ExampleSpec(
+ category=category,
+ module_name=file_path.stem,
+ relative_path=relative_path,
+ has_run_all_examples="run_all_examples" in functions,
+ uses_config_helpers=uses_config_helpers,
+ operation_functions=operation_functions,
+ docstring=docstring,
+ )
+
+
+def render_markdown(specs: list[ExampleSpec]) -> str:
+ lines = [
+ "# Example Specs",
+ "",
+ "Generated by `python scripts/generate_example_specs.py`.",
+ "",
+ f"Total modules: {len(specs)}",
+ "",
+ "| Category | Module | Path | `run_all_examples` | Config helpers | Operations |",
+ "| --- | --- | --- | --- | --- | --- |",
+ ]
+
+ for spec in specs:
+ operations = ", ".join(spec.operation_functions) if spec.operation_functions else "-"
+ lines.append(
+ f"| {spec.category} | {spec.module_name} | `{spec.relative_path}` | "
+ f"{'yes' if spec.has_run_all_examples else 'no'} | "
+ f"{'yes' if spec.uses_config_helpers else 'no'} | {operations} |"
+ )
+
+ return "\n".join(lines) + "\n"
+
+
+def render_errors_markdown(errors: list[ParseError]) -> list[str]:
+ if not errors:
+ return []
+
+ lines = [
+ "",
+ "## Parse Errors",
+ "",
+ "| Path | Error |",
+ "| --- | --- |",
+ ]
+ for error in errors:
+ lines.append(f"| `{error.relative_path}` | {error.error} |")
+ return lines
+
+
+def main() -> None:
+ specs: list[ExampleSpec] = []
+ errors: list[ParseError] = []
+ for file_path in iter_example_files():
+ try:
+ specs.append(parse_module(file_path))
+ except SyntaxError as exc:
+ errors.append(
+ ParseError(
+ relative_path=file_path.relative_to(REPO_ROOT).as_posix(),
+ error=f"{exc.__class__.__name__}: {exc.msg} (line {exc.lineno})",
+ )
+ )
+
+ OUTPUT_ROOT.mkdir(parents=True, exist_ok=True)
+
+ index_json_path = OUTPUT_ROOT / "index.json"
+ index_md_path = OUTPUT_ROOT / "index.md"
+
+ payload = {
+ "generated_from": str(EXAMPLES_ROOT.relative_to(REPO_ROOT)).replace("\\", "/"),
+ "total_modules": len(specs),
+ "modules": [asdict(spec) for spec in specs],
+ "parse_errors": [asdict(error) for error in errors],
+ }
+
+ index_json_path.write_text(
+ json.dumps(payload, indent=2, ensure_ascii=True) + "\n",
+ encoding="utf-8",
+ )
+
+ markdown = render_markdown(specs).rstrip("\n").splitlines()
+ markdown.extend(render_errors_markdown(errors))
+ index_md_path.write_text("\n".join(markdown) + "\n", encoding="utf-8")
+
+ print(f"Wrote {index_json_path.relative_to(REPO_ROOT)}")
+ print(f"Wrote {index_md_path.relative_to(REPO_ROOT)}")
+ if errors:
+ print(f"Skipped {len(errors)} files with syntax errors")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/scripts/generate_example_stub.py b/scripts/generate_example_stub.py
new file mode 100644
index 0000000..f7f0140
--- /dev/null
+++ b/scripts/generate_example_stub.py
@@ -0,0 +1,102 @@
+from __future__ import annotations
+
+import argparse
+from pathlib import Path
+
+
+REPO_ROOT = Path(__file__).resolve().parents[1]
+EXAMPLES_ROOT = REPO_ROOT / "examples"
+
+
+TEMPLATE = """import sys
+from os import path
+
+import aspose.pdf as ap
+
+sys.path.append(path.join(path.dirname(__file__), '..'))
+from config import set_license, initialize_data_dir
+
+
+def {operation_name}(infile, outfile):
+ \"\"\"Run the {operation_name} example.
+
+ Args:
+ infile (str): Input PDF path.
+ outfile (str): Output PDF path.
+
+ Returns:
+ None
+ \"\"\"
+ document = ap.Document(infile)
+ document.save(outfile)
+
+
+def run_all_examples(data_dir=None, license_path=None):
+ \"\"\"Run all examples in this module.\"\"\"
+ set_license(license_path)
+ input_dir, output_dir = initialize_data_dir(data_dir)
+
+ examples = [
+ (\"{display_name}\", {operation_name}, \"{input_file}\", \"{output_file}\"),
+ ]
+
+ for name, func, infile_name, outfile_name in examples:
+ try:
+ infile = path.join(input_dir, infile_name)
+ outfile = path.join(output_dir, outfile_name)
+ print(f\"Running: {{name}}\")
+ func(infile, outfile)
+ print(f\"✅ Success: {{name}}\")
+ except Exception as exc:
+ print(f\"❌ Failed: {{name}} - {{exc}}\")
+
+
+if __name__ == \"__main__\":
+ run_all_examples()
+"""
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(description="Generate a new example module skeleton.")
+ parser.add_argument("--category", required=True, help="Category folder under examples/")
+ parser.add_argument("--name", required=True, help="Module slug without the example_ prefix")
+ parser.add_argument("--operation", required=True, help="Primary operation function name")
+ parser.add_argument(
+ "--input-file",
+ default="input.pdf",
+ help="Default input file name referenced by run_all_examples()",
+ )
+ parser.add_argument(
+ "--output-file",
+ default=None,
+ help="Default output file name. Defaults to _out.pdf",
+ )
+ parser.add_argument("--force", action="store_true", help="Overwrite an existing file")
+ return parser
+
+
+def main() -> None:
+ args = build_parser().parse_args()
+
+ category_dir = EXAMPLES_ROOT / args.category
+ category_dir.mkdir(parents=True, exist_ok=True)
+
+ output_file = args.output_file or f"{args.operation}_out.pdf"
+ target_path = category_dir / f"example_{args.name}.py"
+
+ if target_path.exists() and not args.force:
+ raise SystemExit(f"Refusing to overwrite existing file: {target_path}")
+
+ content = TEMPLATE.format(
+ operation_name=args.operation,
+ display_name=args.operation.replace("_", " ").title(),
+ input_file=args.input_file,
+ output_file=output_file,
+ )
+ target_path.write_text(content, encoding="utf-8")
+
+ print(f"Created {target_path.relative_to(REPO_ROOT)}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/specs/examples/index.json b/specs/examples/index.json
new file mode 100644
index 0000000..4b0f01f
--- /dev/null
+++ b/specs/examples/index.json
@@ -0,0 +1,2425 @@
+{
+ "generated_from": "examples",
+ "total_modules": 173,
+ "modules": [
+ {
+ "category": "accessibility_tagged_pdf",
+ "module_name": "example_tagged_pdf_create",
+ "relative_path": "examples/accessibility_tagged_pdf/example_tagged_pdf_create.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_tagged_pdf_document_simple",
+ "create_tagged_pdf_document_adv",
+ "add_style",
+ "illustrate_structure_elements",
+ "validate_tagged_pdf",
+ "adjust_position",
+ "convert_to_pdf_ua_with_automatic_tagging",
+ "create_pdf_with_tagged_form_field",
+ "create_pdf_with_toc_page",
+ "create_pdf_with_toc_page_advanced"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "accessibility_tagged_pdf",
+ "module_name": "example_tagged_pdf_extract",
+ "relative_path": "examples/accessibility_tagged_pdf/example_tagged_pdf_extract.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_tagged_content",
+ "get_root_structure",
+ "access_child_elements"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "accessibility_tagged_pdf",
+ "module_name": "example_tagged_pdf_set_properties",
+ "relative_path": "examples/accessibility_tagged_pdf/example_tagged_pdf_set_properties.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "set_properties",
+ "set_text_elements",
+ "set_text_block_elements",
+ "set_inline_elements",
+ "set_tag_name",
+ "set_elements",
+ "add_link_element",
+ "set_note_element",
+ "set_language_and_title"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "accessibility_tagged_pdf",
+ "module_name": "example_tagged_pdf_tables",
+ "relative_path": "examples/accessibility_tagged_pdf/example_tagged_pdf_tables.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_table",
+ "style_table",
+ "style_table_row",
+ "style_table_cell",
+ "adjust_table_position"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "attach_zugferd",
+ "module_name": "example_attach_zugferd",
+ "relative_path": "examples/attach_zugferd/example_attach_zugferd.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "attach_invoice_zugferd_format"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "basic_operations",
+ "module_name": "example_merger",
+ "relative_path": "examples/basic_operations/example_merger.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "merge_two_documents"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "basic_operations",
+ "module_name": "example_open",
+ "relative_path": "examples/basic_operations/example_open.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "open_document_from_file",
+ "open_document_from_stream",
+ "open_document_encrypted"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "basic_operations",
+ "module_name": "example_protect",
+ "relative_path": "examples/basic_operations/example_protect.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "encrypt_password",
+ "encrypt_pdf_file",
+ "decrypt_pdf_file",
+ "change_password",
+ "determine_correct_password_from_list"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "basic_operations",
+ "module_name": "example_save",
+ "relative_path": "examples/basic_operations/example_save.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "save_document_to_file",
+ "save_document_to_stream",
+ "save_document_as_standard"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "basic_operations",
+ "module_name": "example_splitter",
+ "relative_path": "examples/basic_operations/example_splitter.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "split_documents"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "compare",
+ "module_name": "example_compare",
+ "relative_path": "examples/compare/example_compare.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "compare_pdf_with_get_difference_method",
+ "comparing_specific_pages",
+ "compare_pdf_with_compare_documents_to_pdf_method",
+ "comparing_entire_documents"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_html_to_pdf",
+ "relative_path": "examples/convert_pdf_document/example_html_to_pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_HTML_to_PDF",
+ "convert_HTML_to_PDF_media_type",
+ "convert_HTML_to_PDF_priority_css_page_rule",
+ "convert_HTML_to_PDF_embed_fonts",
+ "convert_HTML_to_PDF_render_content_to_same_page",
+ "convert_HTML_to_PDF_render_html_with_svg_data",
+ "convert_WebPage_to_PDF",
+ "convert_MHTML_to_PDF"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_images_to_pdf",
+ "relative_path": "examples/convert_pdf_document/example_images_to_pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_BMP_to_PDF",
+ "convert_CGM_to_PDF",
+ "convert_DICOM_to_PDF",
+ "convert_EMF_to_PDF",
+ "convert_GIF_to_PDF",
+ "convert_JPEG_to_PDF",
+ "convert_PNG_to_PDF",
+ "convert_SVG_to_PDF",
+ "convert_TIFF_to_PDF",
+ "convert_CDR_to_PDF"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_other_file_to_pdf",
+ "relative_path": "examples/convert_pdf_document/example_other_file_to_pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_OFD_to_PDF",
+ "convert_TEX_to_PDF",
+ "convert_PS_to_PDF",
+ "convert_EPS_to_PDF",
+ "convert_EPUB_to_PDF",
+ "convert_MD_to_PDF",
+ "convert_TXT_to_PDF_simple",
+ "convert_TXT_to_PDF",
+ "convert_PCL_to_PDF",
+ "transform_xml_to_html",
+ "convert_XML_to_PDF",
+ "convert_XPS_to_PDF",
+ "convert_XSLFO_to_PDF"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_excel",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_excel.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_pdf_to_excel_spread_sheet2003",
+ "convert_pdf_to_excel_2007",
+ "convert_pdf_to_excel_2007_control_column",
+ "convert_pdf_to_excel_2007_single_excel_worksheet",
+ "convert_pdf_to_excel_2007_macro",
+ "convert_pdf_to_excel_2007_csv",
+ "convert_pdf_to_ods"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_html",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_html.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDF_to_HTML",
+ "convert_PDF_to_HTML_storing_images",
+ "convert_PDF_to_HTML_multi_page",
+ "convert_PDF_to_HTML_storing_svg",
+ "convert_PDF_to_HTML_compress_svg",
+ "convert_PDF_to_HTML_PNG_background",
+ "convert_PDF_to_HTML_body_content",
+ "convert_PDF_to_HTML_transparent_text_rendering",
+ "convert_PDF_to_HTML_document_layers_rendering"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_images",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_images.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDF_to_BMP",
+ "convert_PDF_to_EMF",
+ "convert_PDF_to_GIF",
+ "convert_PDF_to_JPEG",
+ "convert_PDF_to_PNG",
+ "convert_PDF_to_PNG_with_default_font",
+ "convert_PDF_to_SVG",
+ "convert_PDF_to_TIFF"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_other_file",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_other_file.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDF_to_EPUB",
+ "convert_PDF_to_TeX",
+ "convert_PDF_to_TXT",
+ "convert_PDF_to_XPS",
+ "convert_PDF_to_MD",
+ "convert_PDF_to_MobiXML"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_pdfx",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_pdfx.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "validate_PDF_PDF_A",
+ "validate_PDF_PDF_E",
+ "convert_PDF_to_PDFA",
+ "convert_PDF_to_PDFA4",
+ "convert_PDF_to_PDFA_with_attachment",
+ "convert_PDF_to_PDFA_replace_missing_fonts",
+ "convert_PDF_to_PDFA_with_automatic_tagging",
+ "convert_PDF_to_PDF_E",
+ "convert_PDF_to_PDF_X"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_powerpoint",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_powerpoint.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDF_to_PPTX",
+ "convert_PDF_to_PPTX_slides_as_images",
+ "convert_PDF_to_PPTX_image_resolution"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdf_to_word",
+ "relative_path": "examples/convert_pdf_document/example_pdf_to_word.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDF_to_DOC",
+ "convert_PDF_to_DOCX",
+ "convert_PDF_to_DOCX_advanced"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "convert_pdf_document",
+ "module_name": "example_pdfx_to_pdf",
+ "relative_path": "examples/convert_pdf_document/example_pdfx_to_pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_PDFA_to_PDF",
+ "convert_PDFUA_to_PDF"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "exporting_pdf_form_data",
+ "relative_path": "examples/facades/form/exporting_pdf_form_data.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "export_pdf_form_data_to_xml",
+ "export_form_data_to_fdf",
+ "export_pdf_form_to_xfdf",
+ "export_form_to_json",
+ "export_xfa_data"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "filling_form_fields",
+ "relative_path": "examples/facades/form/filling_form_fields.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "fill_text_fields",
+ "fill_check_box_fields",
+ "fill_radio_button_fields",
+ "fill_list_box_fields",
+ "fill_barcode_fields",
+ "fill_fields_by_name_and_value"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "importing_pdf_form_data",
+ "relative_path": "examples/facades/form/importing_pdf_form_data.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "import_xml_to_pdf_fields",
+ "import_fdf_to_pdf_form",
+ "import_data_from_xfdf",
+ "import_json_to_pdf_form",
+ "replace_xfa_data"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "managing-pdf-form-fields",
+ "relative_path": "examples/facades/form/managing-pdf-form-fields.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "flatten_specific_fields",
+ "flatten_all_fields",
+ "rename_form_fields"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "reading-and-inspecting-form-data",
+ "relative_path": "examples/facades/form/reading-and-inspecting-form-data.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_field_values",
+ "get_rich_text_values",
+ "get_radio_button_options",
+ "resolve_full_field_names",
+ "get_required_field_names",
+ "get_field_facades"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working_with_button_fields",
+ "relative_path": "examples/facades/form/working_with_button_fields.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_image_appearance_to_button_fields",
+ "get_submit_flags"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "adding_scripts_and_submit_actions",
+ "relative_path": "examples/facades/formeditor/adding_scripts_and_submit_actions.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_field_script",
+ "set_field_script",
+ "remove_field_script",
+ "set_submit_flag",
+ "set_submit_url"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "creating-form-field",
+ "relative_path": "examples/facades/formeditor/creating-form-field.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_checkbox_field",
+ "create_combobox_field",
+ "create_textbox_field",
+ "create_radiobutton_field",
+ "create_listbox_field",
+ "create_submit_button"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "customizing-field-appearance",
+ "relative_path": "examples/facades/formeditor/customizing-field-appearance.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "decorate_field",
+ "set_field_alignment",
+ "set_field_alignment_vertical",
+ "set_field_appearance",
+ "set_field_attribute",
+ "set_field_comb_number",
+ "set_field_limit",
+ "get_field_appearance"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "modifying-form-fields",
+ "relative_path": "examples/facades/formeditor/modifying-form-fields.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_list_item",
+ "del_list_item",
+ "move_field",
+ "remove_field",
+ "rename_field",
+ "single2multiple",
+ "copy_inner_field",
+ "copy_outer_field"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "annotations",
+ "relative_path": "examples/facades/pdf_content_editor/annotations.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_text_annotation",
+ "add_free_text_annotation",
+ "add_caret_annotation",
+ "add_markup_annotation",
+ "add_popup_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "attachments",
+ "relative_path": "examples/facades/pdf_content_editor/attachments.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_attachment",
+ "add_attachment_from_path",
+ "add_file_attachment_annotation",
+ "add_file_attachment_annotation_from_stream",
+ "remove_attachments"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "binding-and-streams",
+ "relative_path": "examples/facades/pdf_content_editor/binding-and-streams.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "constructor_with_document_and_save_stream",
+ "bind_from_stream_and_save_stream",
+ "bind_from_document_and_save_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "document-actions",
+ "relative_path": "examples/facades/pdf_content_editor/document-actions.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_bookmark_action",
+ "add_document_action",
+ "remove_open_action"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "drawing-annotations",
+ "relative_path": "examples/facades/pdf_content_editor/drawing-annotations.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_line_annotation",
+ "add_square_annotation",
+ "add_circle_annotation",
+ "add_polygon_annotation",
+ "add_polyline_annotation",
+ "add_curve_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "images",
+ "relative_path": "examples/facades/pdf_content_editor/images.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "replace_image",
+ "delete_images",
+ "delete_all_image",
+ "run_examples"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "link-and-navigation",
+ "relative_path": "examples/facades/pdf_content_editor/link-and-navigation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_web_link",
+ "add_local_link",
+ "add_pdf_document_link",
+ "add_javascript_link",
+ "add_application_link",
+ "add_custom_action_link",
+ "extract_links"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "multimedia",
+ "relative_path": "examples/facades/pdf_content_editor/multimedia.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_movie_annotation",
+ "add_sound_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "stamps",
+ "relative_path": "examples/facades/pdf_content_editor/stamps.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_rubber_stamp",
+ "delete_stamp_by_index",
+ "manage_stamp_by_id",
+ "delete_stamp_by_ids_examples",
+ "move_stamp_by_index",
+ "move_stamp_by_id_example",
+ "create_rubber_stamp_with_appearance_file",
+ "create_rubber_stamp_with_appearance_stream",
+ "delete_stamps_globally",
+ "list_stamps"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "text-editing",
+ "relative_path": "examples/facades/pdf_content_editor/text-editing.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "replace_text_simple",
+ "replace_text_regex",
+ "replace_text_on_page",
+ "replace_text_with_state",
+ "replace_text_on_page_with_state"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "viewer-preferences",
+ "relative_path": "examples/facades/pdf_content_editor/viewer-preferences.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_viewer_preferences",
+ "change_viewer_preferences"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "booklet-and-nup-layout",
+ "relative_path": "examples/facades/pdf_file_editor/booklet-and-nup-layout.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_pdf_booklet",
+ "try_create_pdf_booklet",
+ "create_nup_pdf_document",
+ "try_create_nup_pdf_document"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "merge-pdf-documents",
+ "relative_path": "examples/facades/pdf_file_editor/merge-pdf-documents.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "page-layout-and-margins",
+ "relative_path": "examples/facades/pdf_file_editor/page-layout-and-margins.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_margins_to_pdf_pages",
+ "resize_pdf_page_contents",
+ "add_page_breaks_in_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "page-managment",
+ "relative_path": "examples/facades/pdf_file_editor/page-managment.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_pages_from_pdf",
+ "delete_pages_from_pdf",
+ "insert_pages_into_pdf",
+ "append_pages_to_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "page-merging",
+ "relative_path": "examples/facades/pdf_file_editor/page-merging.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "concatenate_two_files",
+ "concatenate_pdf_files",
+ "try_concatenate_two_files",
+ "try_concatenate_pdf_files",
+ "concatenate_large_number_files",
+ "concatenate_pdf_files_with_optimization",
+ "concatenate_pdf_forms"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "splitting-pdf-documents",
+ "relative_path": "examples/facades/pdf_file_editor/splitting-pdf-documents.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "split_pdf_from_beginning",
+ "split_pdf_to_end",
+ "split_pdf_into_single_pages"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "document-properties",
+ "relative_path": "examples/facades/pdf_file_info/document-properties.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_pdf_version",
+ "get_document_privileges"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "page-information",
+ "relative_path": "examples/facades/pdf_file_info/page-information.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_page_information",
+ "get_page_offsets"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "pdf-metadata",
+ "relative_path": "examples/facades/pdf_file_info/pdf-metadata.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_pdf_metadata",
+ "set_pdf_metadata",
+ "clear_pdf_metadata",
+ "save_info_with_xmp"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "change-password",
+ "relative_path": "examples/facades/pdf_file_security/change-password.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "change_user_and_owner_password",
+ "change_password_and_reset_security",
+ "try_change_password_without_exception"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "decrypt-pdf",
+ "relative_path": "examples/facades/pdf_file_security/decrypt-pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "decrypt_pdf_with_owner_password",
+ "try_decrypt_pdf_without_exception"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "encrypt-pdf",
+ "relative_path": "examples/facades/pdf_file_security/encrypt-pdf.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "encrypt_pdf_with_user_owner_password",
+ "encrypt_pdf_with_permissions",
+ "encrypt_pdf_with_encryption_algorithm"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "set-privileges",
+ "relative_path": "examples/facades/pdf_file_security/set-privileges.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "set_pdf_privileges_without_passwords",
+ "set_pdf_privileges_with_passwords",
+ "try_set_pdf_privileges_without_exception"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "_pdf_file_signature_helpers",
+ "relative_path": "examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "create_pdf_file_signature",
+ "create_signature_rectangle",
+ "get_certificate_path",
+ "ensure_certificate_file",
+ "configure_signature_certificate",
+ "create_pkcs7_signature",
+ "create_custom_signature_appearance",
+ "create_doc_mdp_signature",
+ "list_signature_names",
+ "require_signature_name",
+ "write_stream_data"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "pdf-certification",
+ "relative_path": "examples/facades/pdf_file_signature/pdf-certification.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "set_certificate_for_signing",
+ "certify_pdf_with_mdp_signature",
+ "apply_document_level_certification"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "pdf-signing",
+ "relative_path": "examples/facades/pdf_file_signature/pdf-signing.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "sign_pdf_with_basic_parameters",
+ "sign_pdf_with_certificate_object",
+ "sign_pdf_with_named_signature",
+ "apply_visible_signature"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "revision-permissions",
+ "relative_path": "examples/facades/pdf_file_signature/revision-permissions.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_signature_revision",
+ "get_total_document_revisions",
+ "get_access_permissions"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "signature-extraction",
+ "relative_path": "examples/facades/pdf_file_signature/signature-extraction.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_signature_image",
+ "extract_signature_certificate"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "signature-information",
+ "relative_path": "examples/facades/pdf_file_signature/signature-information.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_signature_names",
+ "get_signer_details",
+ "get_signature_date_and_time",
+ "get_signature_reason_and_location"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "signature-integrity-checks",
+ "relative_path": "examples/facades/pdf_file_signature/signature-integrity-checks.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "check_signature_coverage",
+ "validate_document_integrity"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "signature-management",
+ "relative_path": "examples/facades/pdf_file_signature/signature-management.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "remove_signature_from_pdf",
+ "remove_signature_with_field_cleanup"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "signature-verification",
+ "relative_path": "examples/facades/pdf_file_signature/signature-verification.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "verify_pdf_signature",
+ "check_if_pdf_contains_signatures"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "usage-rights-management",
+ "relative_path": "examples/facades/pdf_file_signature/usage-rights-management.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "remove_usage_rights"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-pdf-page-stamp_1",
+ "relative_path": "examples/facades/pdf_file_stamp/add-pdf-page-stamp_1.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_page_stamp_on_all_pages"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-pdf-page-stamp_2",
+ "relative_path": "examples/facades/pdf_file_stamp/add-pdf-page-stamp_2.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_page_stamp_on_certain_pages"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-pdf-page-stamp_3",
+ "relative_path": "examples/facades/pdf_file_stamp/add-pdf-page-stamp_3.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_page_number_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-pdf-page-stamp_4",
+ "relative_path": "examples/facades/pdf_file_stamp/add-pdf-page-stamp_4.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_custom_page_number_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-text-and-image-stamp_1",
+ "relative_path": "examples/facades/pdf_file_stamp/add-text-and-image-stamp_1.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_text_stamp_on_all_pages_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-text-and-image-stamp_2",
+ "relative_path": "examples/facades/pdf_file_stamp/add-text-and-image-stamp_2.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_text_stamp_on_particular_pages_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-text-and-image-stamp_3",
+ "relative_path": "examples/facades/pdf_file_stamp/add-text-and-image-stamp_3.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_image_stamp_on_all_pages_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "add-text-and-image-stamp_4",
+ "relative_path": "examples/facades/pdf_file_stamp/add-text-and-image-stamp_4.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_image_stamp_on_particular_pages_in_pdf_file"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "manage-header-and-footer_1",
+ "relative_path": "examples/facades/pdf_file_stamp/manage-header-and-footer_1.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_header"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "manage-header-and-footer_2",
+ "relative_path": "examples/facades/pdf_file_stamp/manage-header-and-footer_2.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_footer"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "manage-header-and-footer_3",
+ "relative_path": "examples/facades/pdf_file_stamp/manage-header-and-footer_3.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_image_header"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "manage-header-and-footer_4",
+ "relative_path": "examples/facades/pdf_file_stamp/manage-header-and-footer_4.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_image_footer"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_1",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_1.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_2",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_2.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "printing_pdf_display_print_dialog"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_3",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_3.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_4",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_4.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_5",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_5.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "printing_pdf_hide_print_dialog"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_6",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_6.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "printing_pdf_to_postscript"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_7",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_7.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "checking_print_job_status"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_8",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_8.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "printing_pages_in_simplex_and_duplex_mode"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "working-with-pdf-printing-facades_9",
+ "relative_path": "examples/facades/pdf_viewer/working-with-pdf-printing-facades_9.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "printing_multiple_documents_in_single_job"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "facades",
+ "module_name": "adding-multi-line-watermark-to-existing-pdf_1",
+ "relative_path": "examples/facades/stamp/adding-multi-line-watermark-to-existing-pdf_1.py",
+ "has_run_all_examples": false,
+ "uses_config_helpers": false,
+ "operation_functions": [
+ "add_text_stamp_to_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "navigation_and_interaction",
+ "module_name": "example_actions",
+ "relative_path": "examples/navigation_and_interaction/example_actions.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_named_action_print",
+ "add_named_action_hide",
+ "add_navigation_buttons",
+ "add_submit_action",
+ "add_launch_actions",
+ "add_page_actions",
+ "remove_page_actions"
+ ],
+ "docstring": "Navigation and interaction actions examples using Aspose.PDF."
+ },
+ {
+ "category": "navigation_and_interaction",
+ "module_name": "example_bookmarks",
+ "relative_path": "examples/navigation_and_interaction/example_bookmarks.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_bookmark",
+ "add_child_bookmark",
+ "delete_bookmarks",
+ "delete_bookmark"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "navigation_and_interaction",
+ "module_name": "example_create_links",
+ "relative_path": "examples/navigation_and_interaction/links/example_create_links.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_link_annotation_launch_action",
+ "create_link_annotation_go_to_remote_action",
+ "create_link_annotation_go_to_action",
+ "create_link_annotation_go_to_URI_action"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "navigation_and_interaction",
+ "module_name": "example_extract_links",
+ "relative_path": "examples/navigation_and_interaction/links/example_extract_links.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_link_annotation",
+ "extract_hyperlinks"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "navigation_and_interaction",
+ "module_name": "example_update_links",
+ "relative_path": "examples/navigation_and_interaction/links/example_update_links.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "link_annotation_update_text_color",
+ "link_annotation_update_border",
+ "link_annotation_update_web_destination"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_acroforms",
+ "relative_path": "examples/parsing/example_parsing_acroforms.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_form_fields",
+ "extract_form_field_by_title",
+ "extract_form_fields_JSON",
+ "extract_form_fields_json_doc",
+ "extract_data_to_xml",
+ "extract_data_to_fdf",
+ "extract_data_to_xfdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_annotation_special_text",
+ "relative_path": "examples/parsing/example_parsing_annotation_special_text.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_highlighted_text",
+ "extract_stamp_text",
+ "extract_super_sub_text",
+ "extract_super_sub_details"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_basic_extraction",
+ "relative_path": "examples/parsing/example_parsing_basic_extraction.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_text_from_all_pages",
+ "extract_text_from_page",
+ "extract_paragraphs_from_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_fonts",
+ "relative_path": "examples/parsing/example_parsing_fonts.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_fonts"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_images",
+ "relative_path": "examples/parsing/example_parsing_images.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_image"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_multi_column",
+ "relative_path": "examples/parsing/example_parsing_multi_column.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_text_reduce_font",
+ "extract_text_scale_factor"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_region_based_extraction",
+ "relative_path": "examples/parsing/example_parsing_region_based_extraction.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_text_from_region",
+ "extract_paragraphs_with_geometry"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_tables",
+ "relative_path": "examples/parsing/example_parsing_tables.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_tables_from_pdf",
+ "extract_table_from_specific_area",
+ "export_tables_to_excel"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "parsing",
+ "module_name": "example_parsing_vector_graphics",
+ "relative_path": "examples/parsing/example_parsing_vector_graphics.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_graphics_elements",
+ "save_vector_graphics_to_svg",
+ "extract_subpaths_to_svgs",
+ "extract_list_of_elements_to_single_image",
+ "extract_single_vector_element"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "pdf_file_metadata",
+ "module_name": "example_metadata",
+ "relative_path": "examples/pdf_file_metadata/example_metadata.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_pdf_file_information",
+ "set_prefix_metadata",
+ "set_file_information",
+ "set_xmp_metadata"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_annotations_import_export",
+ "relative_path": "examples/working_with_annotations/example_annotations_import_export.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "import_export"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_extra_annotation",
+ "relative_path": "examples/working_with_annotations/example_extra_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "mark_text_redaction",
+ "apply_redaction",
+ "redact_area"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_figures_annotation",
+ "relative_path": "examples/working_with_annotations/example_figures_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "square_annotation_add",
+ "circle_annotation_add",
+ "polygon_annotation_add",
+ "polyline_annotation_add",
+ "square_annotation_get",
+ "circle_annotation_get",
+ "polygon_annotation_get",
+ "polyline_annotation_get",
+ "square_annotation_delete",
+ "circle_annotation_delete",
+ "polygon_annotation_delete",
+ "polyline_annotation_delete"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_highlights_annotation",
+ "relative_path": "examples/working_with_annotations/example_highlights_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_text_highlight_annotation",
+ "add_text_strikeout_annotation",
+ "add_text_squiggly_annotation",
+ "add_text_underline_annotation",
+ "get_text_highlight_annotation",
+ "get_text_strikeout_annotation",
+ "get_text_squiggly_annotation",
+ "get_text_underline_annotation",
+ "delete_text_highlight_annotation",
+ "delete_text_strikeout_annotation",
+ "delete_text_squiggly_annotation",
+ "delete_text_underline_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_link_annotation",
+ "relative_path": "examples/working_with_annotations/example_link_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "link_add",
+ "link_get",
+ "link_delete"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_sticky_annotation",
+ "relative_path": "examples/working_with_annotations/example_sticky_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "watermark_add",
+ "watermark_get",
+ "watermark_delete"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_annotations",
+ "module_name": "example_text_annotation",
+ "relative_path": "examples/working_with_annotations/example_text_annotation.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "text_annotation_add",
+ "text_annotation_get",
+ "text_annotation_delete",
+ "free_text_annotation_add",
+ "free_text_annotation_get",
+ "free_text_annotation_delete",
+ "add_text_strikeout_annotation",
+ "get_text_strikeout_annotation",
+ "delete_text_strikeout_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_artifacts",
+ "module_name": "example_artifacts_backgrounds",
+ "relative_path": "examples/working_with_artifacts/example_artifacts_backgrounds.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_background_image_to_pdf",
+ "add_background_image_with_opacity_to_pdf",
+ "add_background_color_to_pdf",
+ "remove_background"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_artifacts",
+ "module_name": "example_artifacts_bates_numbering",
+ "relative_path": "examples/working_with_artifacts/example_artifacts_bates_numbering.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "_create_bates_artifact",
+ "add_bates_n_artifact",
+ "add_bates_n_artifact_pagination",
+ "delete_bates_numbering"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_artifacts",
+ "module_name": "example_artifacts_counting",
+ "relative_path": "examples/working_with_artifacts/example_artifacts_counting.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "count_pdf_artifacts"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_artifacts",
+ "module_name": "example_artifacts_header_footer",
+ "relative_path": "examples/working_with_artifacts/example_artifacts_header_footer.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "_create_text_artifact",
+ "add_header_artifact",
+ "add_footer_artifact",
+ "delete_header_footer_artifact"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_artifacts",
+ "module_name": "example_artifacts_watermarks",
+ "relative_path": "examples/working_with_artifacts/example_artifacts_watermarks.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_watermark_from_pdf",
+ "add_watermark_artifact",
+ "delete_watermark_artifact"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_attachments",
+ "module_name": "example_attachments_add",
+ "relative_path": "examples/working_with_attachments/example_attachments_add.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_attachments"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_attachments",
+ "module_name": "example_attachments_extract",
+ "relative_path": "examples/working_with_attachments/example_attachments_extract.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_single_attachment",
+ "_print_file_params",
+ "extract_attachments",
+ "extract_file_attachment_annotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_attachments",
+ "module_name": "example_attachments_portfolio",
+ "relative_path": "examples/working_with_attachments/example_attachments_portfolio.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_pdf_portfolio",
+ "remove_files_from_PDF_Portfolio"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_attachments",
+ "module_name": "example_attachments_remove",
+ "relative_path": "examples/working_with_attachments/example_attachments_remove.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "remove_attachment",
+ "remove_all_attachments"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_create_pdf_document",
+ "relative_path": "examples/working_with_documents/example_create_pdf_document.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_new_document"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_formatting_pdf_document",
+ "relative_path": "examples/working_with_documents/example_formatting_pdf_document.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_document_window",
+ "set_document_window",
+ "embedded_fonts",
+ "embedded_fonts_in_new_document",
+ "set_default_font",
+ "get_all_fonts",
+ "improve_fonts_embedding",
+ "set_zoom_factor",
+ "get_zoom_factor"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_manipulate_pdf_document",
+ "relative_path": "examples/working_with_documents/example_manipulate_pdf_document.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "_validate_pdfa_standard",
+ "validate_pdfa_standard_a1a",
+ "validate_pdfa_standard_a1b",
+ "add_table_of_contents",
+ "set_toc_levels",
+ "hide_page_numbers_in_toc",
+ "customize_page_numbers_in_toc",
+ "set_pdf_expiry_date",
+ "flatten_fillable_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_merge_pdf_document",
+ "relative_path": "examples/working_with_documents/example_merge_pdf_document.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "merge_two_documents"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_optimize",
+ "relative_path": "examples/working_with_documents/example_optimize.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "optimize_pdf",
+ "reduce_size_pdf",
+ "shrinking_or_compressing_all_images",
+ "removing_unused_objects",
+ "removing_unused_streams",
+ "linking_duplicate_streams",
+ "unembed_fonts",
+ "flatten_annotations",
+ "flatten_forms",
+ "\u0441onvert_PDF_from_RGB_colorspace_to_grayscale",
+ "using_flatedecode_compression"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_split_pdf_document",
+ "relative_path": "examples/working_with_documents/example_split_pdf_document.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "split_documents"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_documents",
+ "module_name": "example_work_with_layers",
+ "relative_path": "examples/working_with_documents/example_work_with_layers.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_layers",
+ "lock_layer",
+ "extract_layers",
+ "extract_layers_stream",
+ "flatten_layers",
+ "merge_layers"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_create",
+ "relative_path": "examples/working_with_forms/example_acroforms_create.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_text_box_field",
+ "add_text_box_field_nt",
+ "add_radio_button",
+ "add_combo_box",
+ "add_checkbox_field_to_pdf",
+ "add_list_box_field_to_pdf",
+ "add_signature_field",
+ "add_barcode_field"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_delete",
+ "relative_path": "examples/working_with_forms/example_acroforms_delete.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "remove_all_forms",
+ "remove_specified_form"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_extract",
+ "relative_path": "examples/working_with_forms/example_acroforms_extract.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_values_from_all_fields"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_fill",
+ "relative_path": "examples/working_with_forms/example_acroforms_fill.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "fill_form"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_import_export",
+ "relative_path": "examples/working_with_forms/example_acroforms_import_export.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "import_data_from_xml",
+ "export_data_to_xml",
+ "import_data_from_fdf",
+ "export_data_to_fdf",
+ "import_data_from_xfdf",
+ "export_data_to_xfdf",
+ "import_data_from_another_pdf",
+ "extract_form_fields_to_json",
+ "extract_form_fields_to_json_doc"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_modifing",
+ "relative_path": "examples/working_with_forms/example_acroforms_modifing.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "clear_text_in_form",
+ "set_field_limit",
+ "get_field_limit",
+ "set_form_field_font",
+ "delete_form_field"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_acroforms_posting",
+ "relative_path": "examples/working_with_forms/example_acroforms_posting.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_submit_button",
+ "add_submit_action"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_forms",
+ "module_name": "example_xfaforms",
+ "relative_path": "examples/working_with_forms/example_xfaforms.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "convert_dynamic_xfa_to_acroform",
+ "convert_xfa_form_with_ignore_needs_rendering"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_arc",
+ "relative_path": "examples/working_with_graphs/example_graphs_arc.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_arc",
+ "add_arc_filled"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_check_bounds",
+ "relative_path": "examples/working_with_graphs/example_graphs_check_bounds.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "check_shape_bounds"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_circle",
+ "relative_path": "examples/working_with_graphs/example_graphs_circle.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_circle",
+ "add_circle_filled"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_curve",
+ "relative_path": "examples/working_with_graphs/example_graphs_curve.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_curve",
+ "add_curve_filled"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_ellipse",
+ "relative_path": "examples/working_with_graphs/example_graphs_ellipse.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_ellipse",
+ "create_ellipse_filled",
+ "add_text_inside_ellipse"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_line",
+ "relative_path": "examples/working_with_graphs/example_graphs_line.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_line",
+ "add_dotted_dashed_line",
+ "draw_line_across_page"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_graphs",
+ "module_name": "example_graphs_rectangle",
+ "relative_path": "examples/working_with_graphs/example_graphs_rectangle.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_rectangle",
+ "create_rectangle_filled",
+ "add_drawing_with_gradient_fill",
+ "create_rectangle_with_alpha_color_channel",
+ "_add_rectangle_to_page",
+ "control_z_order_of_rectangle"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_images",
+ "module_name": "example_add_image",
+ "relative_path": "examples/working_with_images/example_add_image.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_image",
+ "add_image_using_operators",
+ "add_image_set_alternative_text_for_image",
+ "add_image_to_pdf_with_flate_compression"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_images",
+ "module_name": "example_delete_image",
+ "relative_path": "examples/working_with_images/example_delete_image.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "delete_image"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_images",
+ "module_name": "example_extract_image",
+ "relative_path": "examples/working_with_images/example_extract_image.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_image",
+ "extract_image_from_specific_region"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_images",
+ "module_name": "example_get_search_image",
+ "relative_path": "examples/working_with_images/example_get_search_image.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_image_params",
+ "extract_image_types_from_pdf",
+ "extract_image_alt_text",
+ "extract_image_information_from_pdf"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_images",
+ "module_name": "example_replace_image",
+ "relative_path": "examples/working_with_images/example_replace_image.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "replace_image",
+ "replace_image_with_absorber"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_operators",
+ "module_name": "example_operators",
+ "relative_path": "examples/working_with_operators/example_operators.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_image_using_pdf_operators",
+ "draw_xform_on_page",
+ "remove_graphics_objects"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_add_header_footer",
+ "relative_path": "examples/working_with_pages/example_add_header_footer.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_header_and_footer_as_text",
+ "using_header_and_footer_for_page_numbering",
+ "add_header_and_footer_as_html",
+ "add_header_and_footer_as_image",
+ "add_header_and_footer_as_table",
+ "add_header_and_footer_as_latex"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_add_pages",
+ "relative_path": "examples/working_with_pages/example_add_pages.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "insert_empty_page",
+ "add_empty_page_to_end",
+ "add_page_from_another_document"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_change_size",
+ "relative_path": "examples/working_with_pages/example_change_size.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "set_page_size",
+ "get_page_size",
+ "get_page_size_rotation"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_crop",
+ "relative_path": "examples/working_with_pages/example_crop.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "crop_page",
+ "crop_page_by_content"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_delete_pages",
+ "relative_path": "examples/working_with_pages/example_delete_pages.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "delete_page",
+ "delete_bunch_pages"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_get_and_set_page_properties",
+ "relative_path": "examples/working_with_pages/example_get_and_set_page_properties.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "get_page_count",
+ "get_page_count_without_saving",
+ "get_page_properties",
+ "get_page_color_type"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_move_pages",
+ "relative_path": "examples/working_with_pages/example_move_pages.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "moving_page_from_one_document_to_another",
+ "moving_bunch_pages_from_one_document_to_another",
+ "moving_page_in_new_location_in_same_document"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_rotate-pages",
+ "relative_path": "examples/working_with_pages/example_rotate-pages.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "rotate_page"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "extract_pages",
+ "relative_path": "examples/working_with_pages/extract_pages.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract_page",
+ "extract_bunch_pages"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_image_stamp",
+ "relative_path": "examples/working_with_pages/stamping/example_image_stamp.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_image_stamp",
+ "add_image_stamp_with_quality_control",
+ "add_image_as_background_in_floating_box"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_page_stamp",
+ "relative_path": "examples/working_with_pages/stamping/example_page_stamp.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_page_stamp"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_pagenum_stamp",
+ "relative_path": "examples/working_with_pages/stamping/example_pagenum_stamp.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_page_num_stamp",
+ "add_page_num_stamp_roman"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_pages",
+ "module_name": "example_text_stamp",
+ "relative_path": "examples/working_with_pages/stamping/example_text_stamp.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_text_stamp"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_tables",
+ "module_name": "example_add_tables",
+ "relative_path": "examples/working_with_tables/example_add_tables.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_table",
+ "add_rowspan_or_colspan",
+ "add_borders",
+ "auto_fit",
+ "add_image",
+ "add_svg_image",
+ "add_html_fragments",
+ "add_latex_fragments",
+ "add_table_on_new_page",
+ "add_table_hide_borders",
+ "add_margins_or_padding",
+ "create_table_with_round_corner",
+ "add_repeating_rows",
+ "add_repeating_columns",
+ "insert_page_break",
+ "rotated_text_table"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_tables",
+ "module_name": "example_extract_table",
+ "relative_path": "examples/working_with_tables/example_extract_table.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "extract"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_tables",
+ "module_name": "example_integrate_table",
+ "relative_path": "examples/working_with_tables/example_integrate_table.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_table_from_dataframe",
+ "create_pdf_from_dataframe"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_tables",
+ "module_name": "example_manipulate_table",
+ "relative_path": "examples/working_with_tables/example_manipulate_table.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "replace_cells",
+ "replace_table"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_tables",
+ "module_name": "example_remove_table",
+ "relative_path": "examples/working_with_tables/example_remove_table.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "remove_one_table",
+ "remove_all_tables"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_adding",
+ "relative_path": "examples/working_with_text/example_text_adding.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_text_simple_case",
+ "add_paragraph",
+ "add_paragraphs_indents",
+ "add_new_line",
+ "determine_line_break",
+ "get_text_width_dynamically",
+ "add_text_with_hyperlink",
+ "add_text_with_rtl_text",
+ "add_text_with_font_styling",
+ "add_underline_text",
+ "add_text_transparent",
+ "add_text_invisible",
+ "add_text_border",
+ "add_strikeout_text",
+ "apply_gradient_axial_shading_to_text",
+ "apply_gradient_radial_shading_to_text",
+ "add_text_html_fragment",
+ "add_text_latex_fragment",
+ "add_html_fragment",
+ "add_html_fragment_override_text_state",
+ "use_custom_font_from_file",
+ "use_custom_font_from_stream"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_floating_box",
+ "relative_path": "examples/working_with_text/example_text_floating_box.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "create_and_add_floating_box",
+ "multi_column_layout",
+ "multi_column_layout_2",
+ "background_support",
+ "offset_support",
+ "align_text_to_float"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_formatting",
+ "relative_path": "examples/working_with_text/example_text_formatting.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "specify_line_spacing_simple_case",
+ "specify_line_spacing_specific_case",
+ "character_spacing_using_text_fragment",
+ "character_spacing_using_text_paragraph",
+ "create_bullet_list_html_version",
+ "create_numbered_list_html_version",
+ "create_bullet_list_latex_version",
+ "create_numbered_list_latex_version",
+ "create_bullet_list",
+ "create_numbered_list",
+ "add_footnote",
+ "add_footnote_custom_text_style",
+ "add_footnote_custom_text",
+ "add_footnote_with_custom_line_style",
+ "add_footnote_with_image_and_table",
+ "add_endnote",
+ "add_endnote_custom_text",
+ "force_new_page",
+ "using_inline_paragraph_property",
+ "create_multi_column_pdf",
+ "custom_tab_stops"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_replacing",
+ "relative_path": "examples/working_with_text/example_text_replacing.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "replace_text_on_all_pages",
+ "replace_text_in_particular_page_region",
+ "replace_text_and_resize_and_shift_without_changing_font_size",
+ "replace_text_and_resize_and_shift_paragraph",
+ "replace_text_and_resize_and_expand_font",
+ "replace_text_and_fit_text_into_rectangle",
+ "replace_text_based_on_regex",
+ "automatically_rearrange_page_contents",
+ "replace_fonts",
+ "remove_unused_fonts",
+ "remove_all_text_using_absorber1",
+ "remove_all_text_using_absorber2",
+ "remove_all_text_using_absorber3",
+ "remove_hidden_text"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_rotate",
+ "relative_path": "examples/working_with_text/example_text_rotate.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "rotate_text_inside_pdf_1",
+ "rotate_text_inside_pdf_2",
+ "rotate_text_inside_pdf_3",
+ "rotate_text_inside_pdf_4"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_search",
+ "relative_path": "examples/working_with_text/example_text_search.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "text_absorber_search",
+ "text_absorber_search_page",
+ "text_fragment_absorber_search",
+ "text_fragment_absorber_search_page",
+ "text_fragment_absorber_sequential_search",
+ "text_fragment_absorber_search_phrase",
+ "text_fragment_absorber_search_regex",
+ "text_fragment_absorber_search_list_of_phrases",
+ "text_fragment_absorber_search_and_add_hyperlink",
+ "text_fragment_absorber_search_styled_text",
+ "text_fragment_absorber_search_and_highlight"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_text",
+ "module_name": "example_text_tooltip",
+ "relative_path": "examples/working_with_text/example_text_tooltip.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "add_tool_tip_to_searched_text",
+ "create_hidden_text_block"
+ ],
+ "docstring": ""
+ },
+ {
+ "category": "working_with_vector_graphics",
+ "module_name": "example_vector_graphics",
+ "relative_path": "examples/working_with_vector_graphics/example_vector_graphics.py",
+ "has_run_all_examples": true,
+ "uses_config_helpers": true,
+ "operation_functions": [
+ "using_graphics_absorber",
+ "move_graphics",
+ "remove_graphics_method_1",
+ "remove_graphics_method_2",
+ "add_to_another_page_method_1",
+ "add_to_another_page_method_2"
+ ],
+ "docstring": ""
+ }
+ ],
+ "parse_errors": [
+ {
+ "relative_path": "examples/facades/stamp/rotating-stamp-about-the-center-point_1.py",
+ "error": "SyntaxError: unexpected EOF while parsing (line 53)"
+ }
+ ]
+}
diff --git a/specs/examples/index.md b/specs/examples/index.md
new file mode 100644
index 0000000..f18c16f
--- /dev/null
+++ b/specs/examples/index.md
@@ -0,0 +1,187 @@
+# Example Specs
+
+Generated by `python scripts/generate_example_specs.py`.
+
+Total modules: 173
+
+| Category | Module | Path | `run_all_examples` | Config helpers | Operations |
+| --- | --- | --- | --- | --- | --- |
+| accessibility_tagged_pdf | example_tagged_pdf_create | `examples/accessibility_tagged_pdf/example_tagged_pdf_create.py` | yes | yes | create_tagged_pdf_document_simple, create_tagged_pdf_document_adv, add_style, illustrate_structure_elements, validate_tagged_pdf, adjust_position, convert_to_pdf_ua_with_automatic_tagging, create_pdf_with_tagged_form_field, create_pdf_with_toc_page, create_pdf_with_toc_page_advanced |
+| accessibility_tagged_pdf | example_tagged_pdf_extract | `examples/accessibility_tagged_pdf/example_tagged_pdf_extract.py` | yes | yes | get_tagged_content, get_root_structure, access_child_elements |
+| accessibility_tagged_pdf | example_tagged_pdf_set_properties | `examples/accessibility_tagged_pdf/example_tagged_pdf_set_properties.py` | yes | yes | set_properties, set_text_elements, set_text_block_elements, set_inline_elements, set_tag_name, set_elements, add_link_element, set_note_element, set_language_and_title |
+| accessibility_tagged_pdf | example_tagged_pdf_tables | `examples/accessibility_tagged_pdf/example_tagged_pdf_tables.py` | yes | yes | create_table, style_table, style_table_row, style_table_cell, adjust_table_position |
+| attach_zugferd | example_attach_zugferd | `examples/attach_zugferd/example_attach_zugferd.py` | yes | yes | attach_invoice_zugferd_format |
+| basic_operations | example_merger | `examples/basic_operations/example_merger.py` | yes | yes | merge_two_documents |
+| basic_operations | example_open | `examples/basic_operations/example_open.py` | yes | yes | open_document_from_file, open_document_from_stream, open_document_encrypted |
+| basic_operations | example_protect | `examples/basic_operations/example_protect.py` | yes | yes | encrypt_password, encrypt_pdf_file, decrypt_pdf_file, change_password, determine_correct_password_from_list |
+| basic_operations | example_save | `examples/basic_operations/example_save.py` | yes | yes | save_document_to_file, save_document_to_stream, save_document_as_standard |
+| basic_operations | example_splitter | `examples/basic_operations/example_splitter.py` | yes | yes | split_documents |
+| compare | example_compare | `examples/compare/example_compare.py` | yes | yes | compare_pdf_with_get_difference_method, comparing_specific_pages, compare_pdf_with_compare_documents_to_pdf_method, comparing_entire_documents |
+| convert_pdf_document | example_html_to_pdf | `examples/convert_pdf_document/example_html_to_pdf.py` | yes | yes | convert_HTML_to_PDF, convert_HTML_to_PDF_media_type, convert_HTML_to_PDF_priority_css_page_rule, convert_HTML_to_PDF_embed_fonts, convert_HTML_to_PDF_render_content_to_same_page, convert_HTML_to_PDF_render_html_with_svg_data, convert_WebPage_to_PDF, convert_MHTML_to_PDF |
+| convert_pdf_document | example_images_to_pdf | `examples/convert_pdf_document/example_images_to_pdf.py` | yes | yes | convert_BMP_to_PDF, convert_CGM_to_PDF, convert_DICOM_to_PDF, convert_EMF_to_PDF, convert_GIF_to_PDF, convert_JPEG_to_PDF, convert_PNG_to_PDF, convert_SVG_to_PDF, convert_TIFF_to_PDF, convert_CDR_to_PDF |
+| convert_pdf_document | example_other_file_to_pdf | `examples/convert_pdf_document/example_other_file_to_pdf.py` | yes | yes | convert_OFD_to_PDF, convert_TEX_to_PDF, convert_PS_to_PDF, convert_EPS_to_PDF, convert_EPUB_to_PDF, convert_MD_to_PDF, convert_TXT_to_PDF_simple, convert_TXT_to_PDF, convert_PCL_to_PDF, transform_xml_to_html, convert_XML_to_PDF, convert_XPS_to_PDF, convert_XSLFO_to_PDF |
+| convert_pdf_document | example_pdf_to_excel | `examples/convert_pdf_document/example_pdf_to_excel.py` | yes | yes | convert_pdf_to_excel_spread_sheet2003, convert_pdf_to_excel_2007, convert_pdf_to_excel_2007_control_column, convert_pdf_to_excel_2007_single_excel_worksheet, convert_pdf_to_excel_2007_macro, convert_pdf_to_excel_2007_csv, convert_pdf_to_ods |
+| convert_pdf_document | example_pdf_to_html | `examples/convert_pdf_document/example_pdf_to_html.py` | yes | yes | convert_PDF_to_HTML, convert_PDF_to_HTML_storing_images, convert_PDF_to_HTML_multi_page, convert_PDF_to_HTML_storing_svg, convert_PDF_to_HTML_compress_svg, convert_PDF_to_HTML_PNG_background, convert_PDF_to_HTML_body_content, convert_PDF_to_HTML_transparent_text_rendering, convert_PDF_to_HTML_document_layers_rendering |
+| convert_pdf_document | example_pdf_to_images | `examples/convert_pdf_document/example_pdf_to_images.py` | yes | yes | convert_PDF_to_BMP, convert_PDF_to_EMF, convert_PDF_to_GIF, convert_PDF_to_JPEG, convert_PDF_to_PNG, convert_PDF_to_PNG_with_default_font, convert_PDF_to_SVG, convert_PDF_to_TIFF |
+| convert_pdf_document | example_pdf_to_other_file | `examples/convert_pdf_document/example_pdf_to_other_file.py` | yes | yes | convert_PDF_to_EPUB, convert_PDF_to_TeX, convert_PDF_to_TXT, convert_PDF_to_XPS, convert_PDF_to_MD, convert_PDF_to_MobiXML |
+| convert_pdf_document | example_pdf_to_pdfx | `examples/convert_pdf_document/example_pdf_to_pdfx.py` | yes | yes | validate_PDF_PDF_A, validate_PDF_PDF_E, convert_PDF_to_PDFA, convert_PDF_to_PDFA4, convert_PDF_to_PDFA_with_attachment, convert_PDF_to_PDFA_replace_missing_fonts, convert_PDF_to_PDFA_with_automatic_tagging, convert_PDF_to_PDF_E, convert_PDF_to_PDF_X |
+| convert_pdf_document | example_pdf_to_powerpoint | `examples/convert_pdf_document/example_pdf_to_powerpoint.py` | yes | yes | convert_PDF_to_PPTX, convert_PDF_to_PPTX_slides_as_images, convert_PDF_to_PPTX_image_resolution |
+| convert_pdf_document | example_pdf_to_word | `examples/convert_pdf_document/example_pdf_to_word.py` | yes | yes | convert_PDF_to_DOC, convert_PDF_to_DOCX, convert_PDF_to_DOCX_advanced |
+| convert_pdf_document | example_pdfx_to_pdf | `examples/convert_pdf_document/example_pdfx_to_pdf.py` | yes | yes | convert_PDFA_to_PDF, convert_PDFUA_to_PDF |
+| facades | exporting_pdf_form_data | `examples/facades/form/exporting_pdf_form_data.py` | yes | yes | export_pdf_form_data_to_xml, export_form_data_to_fdf, export_pdf_form_to_xfdf, export_form_to_json, export_xfa_data |
+| facades | filling_form_fields | `examples/facades/form/filling_form_fields.py` | yes | yes | fill_text_fields, fill_check_box_fields, fill_radio_button_fields, fill_list_box_fields, fill_barcode_fields, fill_fields_by_name_and_value |
+| facades | importing_pdf_form_data | `examples/facades/form/importing_pdf_form_data.py` | yes | yes | import_xml_to_pdf_fields, import_fdf_to_pdf_form, import_data_from_xfdf, import_json_to_pdf_form, replace_xfa_data |
+| facades | managing-pdf-form-fields | `examples/facades/form/managing-pdf-form-fields.py` | yes | yes | flatten_specific_fields, flatten_all_fields, rename_form_fields |
+| facades | reading-and-inspecting-form-data | `examples/facades/form/reading-and-inspecting-form-data.py` | yes | yes | get_field_values, get_rich_text_values, get_radio_button_options, resolve_full_field_names, get_required_field_names, get_field_facades |
+| facades | working_with_button_fields | `examples/facades/form/working_with_button_fields.py` | yes | yes | add_image_appearance_to_button_fields, get_submit_flags |
+| facades | adding_scripts_and_submit_actions | `examples/facades/formeditor/adding_scripts_and_submit_actions.py` | yes | yes | add_field_script, set_field_script, remove_field_script, set_submit_flag, set_submit_url |
+| facades | creating-form-field | `examples/facades/formeditor/creating-form-field.py` | yes | yes | create_checkbox_field, create_combobox_field, create_textbox_field, create_radiobutton_field, create_listbox_field, create_submit_button |
+| facades | customizing-field-appearance | `examples/facades/formeditor/customizing-field-appearance.py` | yes | yes | decorate_field, set_field_alignment, set_field_alignment_vertical, set_field_appearance, set_field_attribute, set_field_comb_number, set_field_limit, get_field_appearance |
+| facades | modifying-form-fields | `examples/facades/formeditor/modifying-form-fields.py` | yes | yes | add_list_item, del_list_item, move_field, remove_field, rename_field, single2multiple, copy_inner_field, copy_outer_field |
+| facades | annotations | `examples/facades/pdf_content_editor/annotations.py` | yes | yes | add_text_annotation, add_free_text_annotation, add_caret_annotation, add_markup_annotation, add_popup_annotation |
+| facades | attachments | `examples/facades/pdf_content_editor/attachments.py` | yes | yes | add_attachment, add_attachment_from_path, add_file_attachment_annotation, add_file_attachment_annotation_from_stream, remove_attachments |
+| facades | binding-and-streams | `examples/facades/pdf_content_editor/binding-and-streams.py` | yes | yes | constructor_with_document_and_save_stream, bind_from_stream_and_save_stream, bind_from_document_and_save_file |
+| facades | document-actions | `examples/facades/pdf_content_editor/document-actions.py` | yes | yes | add_bookmark_action, add_document_action, remove_open_action |
+| facades | drawing-annotations | `examples/facades/pdf_content_editor/drawing-annotations.py` | yes | yes | add_line_annotation, add_square_annotation, add_circle_annotation, add_polygon_annotation, add_polyline_annotation, add_curve_annotation |
+| facades | images | `examples/facades/pdf_content_editor/images.py` | no | yes | replace_image, delete_images, delete_all_image, run_examples |
+| facades | link-and-navigation | `examples/facades/pdf_content_editor/link-and-navigation.py` | yes | yes | add_web_link, add_local_link, add_pdf_document_link, add_javascript_link, add_application_link, add_custom_action_link, extract_links |
+| facades | multimedia | `examples/facades/pdf_content_editor/multimedia.py` | yes | yes | add_movie_annotation, add_sound_annotation |
+| facades | stamps | `examples/facades/pdf_content_editor/stamps.py` | yes | yes | add_rubber_stamp, delete_stamp_by_index, manage_stamp_by_id, delete_stamp_by_ids_examples, move_stamp_by_index, move_stamp_by_id_example, create_rubber_stamp_with_appearance_file, create_rubber_stamp_with_appearance_stream, delete_stamps_globally, list_stamps |
+| facades | text-editing | `examples/facades/pdf_content_editor/text-editing.py` | yes | yes | replace_text_simple, replace_text_regex, replace_text_on_page, replace_text_with_state, replace_text_on_page_with_state |
+| facades | viewer-preferences | `examples/facades/pdf_content_editor/viewer-preferences.py` | yes | yes | get_viewer_preferences, change_viewer_preferences |
+| facades | booklet-and-nup-layout | `examples/facades/pdf_file_editor/booklet-and-nup-layout.py` | yes | yes | create_pdf_booklet, try_create_pdf_booklet, create_nup_pdf_document, try_create_nup_pdf_document |
+| facades | merge-pdf-documents | `examples/facades/pdf_file_editor/merge-pdf-documents.py` | no | no | - |
+| facades | page-layout-and-margins | `examples/facades/pdf_file_editor/page-layout-and-margins.py` | yes | yes | add_margins_to_pdf_pages, resize_pdf_page_contents, add_page_breaks_in_pdf |
+| facades | page-managment | `examples/facades/pdf_file_editor/page-managment.py` | yes | yes | extract_pages_from_pdf, delete_pages_from_pdf, insert_pages_into_pdf, append_pages_to_pdf |
+| facades | page-merging | `examples/facades/pdf_file_editor/page-merging.py` | yes | yes | concatenate_two_files, concatenate_pdf_files, try_concatenate_two_files, try_concatenate_pdf_files, concatenate_large_number_files, concatenate_pdf_files_with_optimization, concatenate_pdf_forms |
+| facades | splitting-pdf-documents | `examples/facades/pdf_file_editor/splitting-pdf-documents.py` | yes | yes | split_pdf_from_beginning, split_pdf_to_end, split_pdf_into_single_pages |
+| facades | document-properties | `examples/facades/pdf_file_info/document-properties.py` | yes | yes | get_pdf_version, get_document_privileges |
+| facades | page-information | `examples/facades/pdf_file_info/page-information.py` | yes | yes | get_page_information, get_page_offsets |
+| facades | pdf-metadata | `examples/facades/pdf_file_info/pdf-metadata.py` | yes | yes | get_pdf_metadata, set_pdf_metadata, clear_pdf_metadata, save_info_with_xmp |
+| facades | change-password | `examples/facades/pdf_file_security/change-password.py` | yes | yes | change_user_and_owner_password, change_password_and_reset_security, try_change_password_without_exception |
+| facades | decrypt-pdf | `examples/facades/pdf_file_security/decrypt-pdf.py` | yes | yes | decrypt_pdf_with_owner_password, try_decrypt_pdf_without_exception |
+| facades | encrypt-pdf | `examples/facades/pdf_file_security/encrypt-pdf.py` | yes | yes | encrypt_pdf_with_user_owner_password, encrypt_pdf_with_permissions, encrypt_pdf_with_encryption_algorithm |
+| facades | set-privileges | `examples/facades/pdf_file_security/set-privileges.py` | yes | yes | set_pdf_privileges_without_passwords, set_pdf_privileges_with_passwords, try_set_pdf_privileges_without_exception |
+| facades | _pdf_file_signature_helpers | `examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py` | no | no | create_pdf_file_signature, create_signature_rectangle, get_certificate_path, ensure_certificate_file, configure_signature_certificate, create_pkcs7_signature, create_custom_signature_appearance, create_doc_mdp_signature, list_signature_names, require_signature_name, write_stream_data |
+| facades | pdf-certification | `examples/facades/pdf_file_signature/pdf-certification.py` | yes | yes | set_certificate_for_signing, certify_pdf_with_mdp_signature, apply_document_level_certification |
+| facades | pdf-signing | `examples/facades/pdf_file_signature/pdf-signing.py` | yes | yes | sign_pdf_with_basic_parameters, sign_pdf_with_certificate_object, sign_pdf_with_named_signature, apply_visible_signature |
+| facades | revision-permissions | `examples/facades/pdf_file_signature/revision-permissions.py` | yes | yes | get_signature_revision, get_total_document_revisions, get_access_permissions |
+| facades | signature-extraction | `examples/facades/pdf_file_signature/signature-extraction.py` | yes | yes | extract_signature_image, extract_signature_certificate |
+| facades | signature-information | `examples/facades/pdf_file_signature/signature-information.py` | yes | yes | get_signature_names, get_signer_details, get_signature_date_and_time, get_signature_reason_and_location |
+| facades | signature-integrity-checks | `examples/facades/pdf_file_signature/signature-integrity-checks.py` | yes | yes | check_signature_coverage, validate_document_integrity |
+| facades | signature-management | `examples/facades/pdf_file_signature/signature-management.py` | yes | yes | remove_signature_from_pdf, remove_signature_with_field_cleanup |
+| facades | signature-verification | `examples/facades/pdf_file_signature/signature-verification.py` | yes | yes | verify_pdf_signature, check_if_pdf_contains_signatures |
+| facades | usage-rights-management | `examples/facades/pdf_file_signature/usage-rights-management.py` | yes | yes | remove_usage_rights |
+| facades | add-pdf-page-stamp_1 | `examples/facades/pdf_file_stamp/add-pdf-page-stamp_1.py` | no | no | add_page_stamp_on_all_pages |
+| facades | add-pdf-page-stamp_2 | `examples/facades/pdf_file_stamp/add-pdf-page-stamp_2.py` | no | no | add_page_stamp_on_certain_pages |
+| facades | add-pdf-page-stamp_3 | `examples/facades/pdf_file_stamp/add-pdf-page-stamp_3.py` | no | no | add_page_number_in_pdf_file |
+| facades | add-pdf-page-stamp_4 | `examples/facades/pdf_file_stamp/add-pdf-page-stamp_4.py` | no | no | add_custom_page_number_in_pdf_file |
+| facades | add-text-and-image-stamp_1 | `examples/facades/pdf_file_stamp/add-text-and-image-stamp_1.py` | no | no | add_text_stamp_on_all_pages_in_pdf_file |
+| facades | add-text-and-image-stamp_2 | `examples/facades/pdf_file_stamp/add-text-and-image-stamp_2.py` | no | no | add_text_stamp_on_particular_pages_in_pdf_file |
+| facades | add-text-and-image-stamp_3 | `examples/facades/pdf_file_stamp/add-text-and-image-stamp_3.py` | no | no | add_image_stamp_on_all_pages_in_pdf_file |
+| facades | add-text-and-image-stamp_4 | `examples/facades/pdf_file_stamp/add-text-and-image-stamp_4.py` | no | no | add_image_stamp_on_particular_pages_in_pdf_file |
+| facades | manage-header-and-footer_1 | `examples/facades/pdf_file_stamp/manage-header-and-footer_1.py` | no | no | add_header |
+| facades | manage-header-and-footer_2 | `examples/facades/pdf_file_stamp/manage-header-and-footer_2.py` | no | no | add_footer |
+| facades | manage-header-and-footer_3 | `examples/facades/pdf_file_stamp/manage-header-and-footer_3.py` | no | no | add_image_header |
+| facades | manage-header-and-footer_4 | `examples/facades/pdf_file_stamp/manage-header-and-footer_4.py` | no | no | add_image_footer |
+| facades | working-with-pdf-printing-facades_1 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_1.py` | no | no | - |
+| facades | working-with-pdf-printing-facades_2 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_2.py` | no | no | printing_pdf_display_print_dialog |
+| facades | working-with-pdf-printing-facades_3 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_3.py` | no | no | - |
+| facades | working-with-pdf-printing-facades_4 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_4.py` | no | no | - |
+| facades | working-with-pdf-printing-facades_5 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_5.py` | no | no | printing_pdf_hide_print_dialog |
+| facades | working-with-pdf-printing-facades_6 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_6.py` | no | no | printing_pdf_to_postscript |
+| facades | working-with-pdf-printing-facades_7 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_7.py` | no | no | checking_print_job_status |
+| facades | working-with-pdf-printing-facades_8 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_8.py` | no | no | printing_pages_in_simplex_and_duplex_mode |
+| facades | working-with-pdf-printing-facades_9 | `examples/facades/pdf_viewer/working-with-pdf-printing-facades_9.py` | no | no | printing_multiple_documents_in_single_job |
+| facades | adding-multi-line-watermark-to-existing-pdf_1 | `examples/facades/stamp/adding-multi-line-watermark-to-existing-pdf_1.py` | no | no | add_text_stamp_to_pdf |
+| navigation_and_interaction | example_actions | `examples/navigation_and_interaction/example_actions.py` | yes | yes | add_named_action_print, add_named_action_hide, add_navigation_buttons, add_submit_action, add_launch_actions, add_page_actions, remove_page_actions |
+| navigation_and_interaction | example_bookmarks | `examples/navigation_and_interaction/example_bookmarks.py` | yes | yes | add_bookmark, add_child_bookmark, delete_bookmarks, delete_bookmark |
+| navigation_and_interaction | example_create_links | `examples/navigation_and_interaction/links/example_create_links.py` | yes | yes | create_link_annotation_launch_action, create_link_annotation_go_to_remote_action, create_link_annotation_go_to_action, create_link_annotation_go_to_URI_action |
+| navigation_and_interaction | example_extract_links | `examples/navigation_and_interaction/links/example_extract_links.py` | yes | yes | extract_link_annotation, extract_hyperlinks |
+| navigation_and_interaction | example_update_links | `examples/navigation_and_interaction/links/example_update_links.py` | yes | yes | link_annotation_update_text_color, link_annotation_update_border, link_annotation_update_web_destination |
+| parsing | example_parsing_acroforms | `examples/parsing/example_parsing_acroforms.py` | yes | yes | extract_form_fields, extract_form_field_by_title, extract_form_fields_JSON, extract_form_fields_json_doc, extract_data_to_xml, extract_data_to_fdf, extract_data_to_xfdf |
+| parsing | example_parsing_annotation_special_text | `examples/parsing/example_parsing_annotation_special_text.py` | yes | yes | extract_highlighted_text, extract_stamp_text, extract_super_sub_text, extract_super_sub_details |
+| parsing | example_parsing_basic_extraction | `examples/parsing/example_parsing_basic_extraction.py` | yes | yes | extract_text_from_all_pages, extract_text_from_page, extract_paragraphs_from_pdf |
+| parsing | example_parsing_fonts | `examples/parsing/example_parsing_fonts.py` | yes | yes | extract_fonts |
+| parsing | example_parsing_images | `examples/parsing/example_parsing_images.py` | yes | yes | extract_image |
+| parsing | example_parsing_multi_column | `examples/parsing/example_parsing_multi_column.py` | yes | yes | extract_text_reduce_font, extract_text_scale_factor |
+| parsing | example_parsing_region_based_extraction | `examples/parsing/example_parsing_region_based_extraction.py` | yes | yes | extract_text_from_region, extract_paragraphs_with_geometry |
+| parsing | example_parsing_tables | `examples/parsing/example_parsing_tables.py` | yes | yes | extract_tables_from_pdf, extract_table_from_specific_area, export_tables_to_excel |
+| parsing | example_parsing_vector_graphics | `examples/parsing/example_parsing_vector_graphics.py` | yes | yes | extract_graphics_elements, save_vector_graphics_to_svg, extract_subpaths_to_svgs, extract_list_of_elements_to_single_image, extract_single_vector_element |
+| pdf_file_metadata | example_metadata | `examples/pdf_file_metadata/example_metadata.py` | yes | yes | get_pdf_file_information, set_prefix_metadata, set_file_information, set_xmp_metadata |
+| working_with_annotations | example_annotations_import_export | `examples/working_with_annotations/example_annotations_import_export.py` | yes | yes | import_export |
+| working_with_annotations | example_extra_annotation | `examples/working_with_annotations/example_extra_annotation.py` | yes | yes | mark_text_redaction, apply_redaction, redact_area |
+| working_with_annotations | example_figures_annotation | `examples/working_with_annotations/example_figures_annotation.py` | yes | yes | square_annotation_add, circle_annotation_add, polygon_annotation_add, polyline_annotation_add, square_annotation_get, circle_annotation_get, polygon_annotation_get, polyline_annotation_get, square_annotation_delete, circle_annotation_delete, polygon_annotation_delete, polyline_annotation_delete |
+| working_with_annotations | example_highlights_annotation | `examples/working_with_annotations/example_highlights_annotation.py` | yes | yes | add_text_highlight_annotation, add_text_strikeout_annotation, add_text_squiggly_annotation, add_text_underline_annotation, get_text_highlight_annotation, get_text_strikeout_annotation, get_text_squiggly_annotation, get_text_underline_annotation, delete_text_highlight_annotation, delete_text_strikeout_annotation, delete_text_squiggly_annotation, delete_text_underline_annotation |
+| working_with_annotations | example_link_annotation | `examples/working_with_annotations/example_link_annotation.py` | yes | yes | link_add, link_get, link_delete |
+| working_with_annotations | example_sticky_annotation | `examples/working_with_annotations/example_sticky_annotation.py` | yes | yes | watermark_add, watermark_get, watermark_delete |
+| working_with_annotations | example_text_annotation | `examples/working_with_annotations/example_text_annotation.py` | yes | yes | text_annotation_add, text_annotation_get, text_annotation_delete, free_text_annotation_add, free_text_annotation_get, free_text_annotation_delete, add_text_strikeout_annotation, get_text_strikeout_annotation, delete_text_strikeout_annotation |
+| working_with_artifacts | example_artifacts_backgrounds | `examples/working_with_artifacts/example_artifacts_backgrounds.py` | yes | yes | add_background_image_to_pdf, add_background_image_with_opacity_to_pdf, add_background_color_to_pdf, remove_background |
+| working_with_artifacts | example_artifacts_bates_numbering | `examples/working_with_artifacts/example_artifacts_bates_numbering.py` | yes | yes | _create_bates_artifact, add_bates_n_artifact, add_bates_n_artifact_pagination, delete_bates_numbering |
+| working_with_artifacts | example_artifacts_counting | `examples/working_with_artifacts/example_artifacts_counting.py` | yes | yes | count_pdf_artifacts |
+| working_with_artifacts | example_artifacts_header_footer | `examples/working_with_artifacts/example_artifacts_header_footer.py` | yes | yes | _create_text_artifact, add_header_artifact, add_footer_artifact, delete_header_footer_artifact |
+| working_with_artifacts | example_artifacts_watermarks | `examples/working_with_artifacts/example_artifacts_watermarks.py` | yes | yes | extract_watermark_from_pdf, add_watermark_artifact, delete_watermark_artifact |
+| working_with_attachments | example_attachments_add | `examples/working_with_attachments/example_attachments_add.py` | yes | yes | add_attachments |
+| working_with_attachments | example_attachments_extract | `examples/working_with_attachments/example_attachments_extract.py` | yes | yes | extract_single_attachment, _print_file_params, extract_attachments, extract_file_attachment_annotation |
+| working_with_attachments | example_attachments_portfolio | `examples/working_with_attachments/example_attachments_portfolio.py` | yes | yes | create_pdf_portfolio, remove_files_from_PDF_Portfolio |
+| working_with_attachments | example_attachments_remove | `examples/working_with_attachments/example_attachments_remove.py` | yes | yes | remove_attachment, remove_all_attachments |
+| working_with_documents | example_create_pdf_document | `examples/working_with_documents/example_create_pdf_document.py` | yes | yes | create_new_document |
+| working_with_documents | example_formatting_pdf_document | `examples/working_with_documents/example_formatting_pdf_document.py` | yes | yes | get_document_window, set_document_window, embedded_fonts, embedded_fonts_in_new_document, set_default_font, get_all_fonts, improve_fonts_embedding, set_zoom_factor, get_zoom_factor |
+| working_with_documents | example_manipulate_pdf_document | `examples/working_with_documents/example_manipulate_pdf_document.py` | yes | yes | _validate_pdfa_standard, validate_pdfa_standard_a1a, validate_pdfa_standard_a1b, add_table_of_contents, set_toc_levels, hide_page_numbers_in_toc, customize_page_numbers_in_toc, set_pdf_expiry_date, flatten_fillable_pdf |
+| working_with_documents | example_merge_pdf_document | `examples/working_with_documents/example_merge_pdf_document.py` | yes | yes | merge_two_documents |
+| working_with_documents | example_optimize | `examples/working_with_documents/example_optimize.py` | yes | yes | optimize_pdf, reduce_size_pdf, shrinking_or_compressing_all_images, removing_unused_objects, removing_unused_streams, linking_duplicate_streams, unembed_fonts, flatten_annotations, flatten_forms, сonvert_PDF_from_RGB_colorspace_to_grayscale, using_flatedecode_compression |
+| working_with_documents | example_split_pdf_document | `examples/working_with_documents/example_split_pdf_document.py` | yes | yes | split_documents |
+| working_with_documents | example_work_with_layers | `examples/working_with_documents/example_work_with_layers.py` | yes | yes | add_layers, lock_layer, extract_layers, extract_layers_stream, flatten_layers, merge_layers |
+| working_with_forms | example_acroforms_create | `examples/working_with_forms/example_acroforms_create.py` | yes | yes | add_text_box_field, add_text_box_field_nt, add_radio_button, add_combo_box, add_checkbox_field_to_pdf, add_list_box_field_to_pdf, add_signature_field, add_barcode_field |
+| working_with_forms | example_acroforms_delete | `examples/working_with_forms/example_acroforms_delete.py` | yes | yes | remove_all_forms, remove_specified_form |
+| working_with_forms | example_acroforms_extract | `examples/working_with_forms/example_acroforms_extract.py` | yes | yes | get_values_from_all_fields |
+| working_with_forms | example_acroforms_fill | `examples/working_with_forms/example_acroforms_fill.py` | yes | yes | fill_form |
+| working_with_forms | example_acroforms_import_export | `examples/working_with_forms/example_acroforms_import_export.py` | yes | yes | import_data_from_xml, export_data_to_xml, import_data_from_fdf, export_data_to_fdf, import_data_from_xfdf, export_data_to_xfdf, import_data_from_another_pdf, extract_form_fields_to_json, extract_form_fields_to_json_doc |
+| working_with_forms | example_acroforms_modifing | `examples/working_with_forms/example_acroforms_modifing.py` | yes | yes | clear_text_in_form, set_field_limit, get_field_limit, set_form_field_font, delete_form_field |
+| working_with_forms | example_acroforms_posting | `examples/working_with_forms/example_acroforms_posting.py` | yes | yes | add_submit_button, add_submit_action |
+| working_with_forms | example_xfaforms | `examples/working_with_forms/example_xfaforms.py` | yes | yes | convert_dynamic_xfa_to_acroform, convert_xfa_form_with_ignore_needs_rendering |
+| working_with_graphs | example_graphs_arc | `examples/working_with_graphs/example_graphs_arc.py` | yes | yes | add_arc, add_arc_filled |
+| working_with_graphs | example_graphs_check_bounds | `examples/working_with_graphs/example_graphs_check_bounds.py` | yes | yes | check_shape_bounds |
+| working_with_graphs | example_graphs_circle | `examples/working_with_graphs/example_graphs_circle.py` | yes | yes | add_circle, add_circle_filled |
+| working_with_graphs | example_graphs_curve | `examples/working_with_graphs/example_graphs_curve.py` | yes | yes | add_curve, add_curve_filled |
+| working_with_graphs | example_graphs_ellipse | `examples/working_with_graphs/example_graphs_ellipse.py` | yes | yes | add_ellipse, create_ellipse_filled, add_text_inside_ellipse |
+| working_with_graphs | example_graphs_line | `examples/working_with_graphs/example_graphs_line.py` | yes | yes | add_line, add_dotted_dashed_line, draw_line_across_page |
+| working_with_graphs | example_graphs_rectangle | `examples/working_with_graphs/example_graphs_rectangle.py` | yes | yes | add_rectangle, create_rectangle_filled, add_drawing_with_gradient_fill, create_rectangle_with_alpha_color_channel, _add_rectangle_to_page, control_z_order_of_rectangle |
+| working_with_images | example_add_image | `examples/working_with_images/example_add_image.py` | yes | yes | add_image, add_image_using_operators, add_image_set_alternative_text_for_image, add_image_to_pdf_with_flate_compression |
+| working_with_images | example_delete_image | `examples/working_with_images/example_delete_image.py` | yes | yes | delete_image |
+| working_with_images | example_extract_image | `examples/working_with_images/example_extract_image.py` | yes | yes | extract_image, extract_image_from_specific_region |
+| working_with_images | example_get_search_image | `examples/working_with_images/example_get_search_image.py` | yes | yes | extract_image_params, extract_image_types_from_pdf, extract_image_alt_text, extract_image_information_from_pdf |
+| working_with_images | example_replace_image | `examples/working_with_images/example_replace_image.py` | yes | yes | replace_image, replace_image_with_absorber |
+| working_with_operators | example_operators | `examples/working_with_operators/example_operators.py` | yes | yes | add_image_using_pdf_operators, draw_xform_on_page, remove_graphics_objects |
+| working_with_pages | example_add_header_footer | `examples/working_with_pages/example_add_header_footer.py` | yes | yes | add_header_and_footer_as_text, using_header_and_footer_for_page_numbering, add_header_and_footer_as_html, add_header_and_footer_as_image, add_header_and_footer_as_table, add_header_and_footer_as_latex |
+| working_with_pages | example_add_pages | `examples/working_with_pages/example_add_pages.py` | yes | yes | insert_empty_page, add_empty_page_to_end, add_page_from_another_document |
+| working_with_pages | example_change_size | `examples/working_with_pages/example_change_size.py` | yes | yes | set_page_size, get_page_size, get_page_size_rotation |
+| working_with_pages | example_crop | `examples/working_with_pages/example_crop.py` | yes | yes | crop_page, crop_page_by_content |
+| working_with_pages | example_delete_pages | `examples/working_with_pages/example_delete_pages.py` | yes | yes | delete_page, delete_bunch_pages |
+| working_with_pages | example_get_and_set_page_properties | `examples/working_with_pages/example_get_and_set_page_properties.py` | yes | yes | get_page_count, get_page_count_without_saving, get_page_properties, get_page_color_type |
+| working_with_pages | example_move_pages | `examples/working_with_pages/example_move_pages.py` | yes | yes | moving_page_from_one_document_to_another, moving_bunch_pages_from_one_document_to_another, moving_page_in_new_location_in_same_document |
+| working_with_pages | example_rotate-pages | `examples/working_with_pages/example_rotate-pages.py` | yes | yes | rotate_page |
+| working_with_pages | extract_pages | `examples/working_with_pages/extract_pages.py` | yes | yes | extract_page, extract_bunch_pages |
+| working_with_pages | example_image_stamp | `examples/working_with_pages/stamping/example_image_stamp.py` | yes | yes | add_image_stamp, add_image_stamp_with_quality_control, add_image_as_background_in_floating_box |
+| working_with_pages | example_page_stamp | `examples/working_with_pages/stamping/example_page_stamp.py` | yes | yes | add_page_stamp |
+| working_with_pages | example_pagenum_stamp | `examples/working_with_pages/stamping/example_pagenum_stamp.py` | yes | yes | add_page_num_stamp, add_page_num_stamp_roman |
+| working_with_pages | example_text_stamp | `examples/working_with_pages/stamping/example_text_stamp.py` | yes | yes | add_text_stamp |
+| working_with_tables | example_add_tables | `examples/working_with_tables/example_add_tables.py` | yes | yes | create_table, add_rowspan_or_colspan, add_borders, auto_fit, add_image, add_svg_image, add_html_fragments, add_latex_fragments, add_table_on_new_page, add_table_hide_borders, add_margins_or_padding, create_table_with_round_corner, add_repeating_rows, add_repeating_columns, insert_page_break, rotated_text_table |
+| working_with_tables | example_extract_table | `examples/working_with_tables/example_extract_table.py` | yes | yes | extract |
+| working_with_tables | example_integrate_table | `examples/working_with_tables/example_integrate_table.py` | yes | yes | create_table_from_dataframe, create_pdf_from_dataframe |
+| working_with_tables | example_manipulate_table | `examples/working_with_tables/example_manipulate_table.py` | yes | yes | replace_cells, replace_table |
+| working_with_tables | example_remove_table | `examples/working_with_tables/example_remove_table.py` | yes | yes | remove_one_table, remove_all_tables |
+| working_with_text | example_text_adding | `examples/working_with_text/example_text_adding.py` | yes | yes | add_text_simple_case, add_paragraph, add_paragraphs_indents, add_new_line, determine_line_break, get_text_width_dynamically, add_text_with_hyperlink, add_text_with_rtl_text, add_text_with_font_styling, add_underline_text, add_text_transparent, add_text_invisible, add_text_border, add_strikeout_text, apply_gradient_axial_shading_to_text, apply_gradient_radial_shading_to_text, add_text_html_fragment, add_text_latex_fragment, add_html_fragment, add_html_fragment_override_text_state, use_custom_font_from_file, use_custom_font_from_stream |
+| working_with_text | example_text_floating_box | `examples/working_with_text/example_text_floating_box.py` | yes | yes | create_and_add_floating_box, multi_column_layout, multi_column_layout_2, background_support, offset_support, align_text_to_float |
+| working_with_text | example_text_formatting | `examples/working_with_text/example_text_formatting.py` | yes | yes | specify_line_spacing_simple_case, specify_line_spacing_specific_case, character_spacing_using_text_fragment, character_spacing_using_text_paragraph, create_bullet_list_html_version, create_numbered_list_html_version, create_bullet_list_latex_version, create_numbered_list_latex_version, create_bullet_list, create_numbered_list, add_footnote, add_footnote_custom_text_style, add_footnote_custom_text, add_footnote_with_custom_line_style, add_footnote_with_image_and_table, add_endnote, add_endnote_custom_text, force_new_page, using_inline_paragraph_property, create_multi_column_pdf, custom_tab_stops |
+| working_with_text | example_text_replacing | `examples/working_with_text/example_text_replacing.py` | yes | yes | replace_text_on_all_pages, replace_text_in_particular_page_region, replace_text_and_resize_and_shift_without_changing_font_size, replace_text_and_resize_and_shift_paragraph, replace_text_and_resize_and_expand_font, replace_text_and_fit_text_into_rectangle, replace_text_based_on_regex, automatically_rearrange_page_contents, replace_fonts, remove_unused_fonts, remove_all_text_using_absorber1, remove_all_text_using_absorber2, remove_all_text_using_absorber3, remove_hidden_text |
+| working_with_text | example_text_rotate | `examples/working_with_text/example_text_rotate.py` | yes | yes | rotate_text_inside_pdf_1, rotate_text_inside_pdf_2, rotate_text_inside_pdf_3, rotate_text_inside_pdf_4 |
+| working_with_text | example_text_search | `examples/working_with_text/example_text_search.py` | yes | yes | text_absorber_search, text_absorber_search_page, text_fragment_absorber_search, text_fragment_absorber_search_page, text_fragment_absorber_sequential_search, text_fragment_absorber_search_phrase, text_fragment_absorber_search_regex, text_fragment_absorber_search_list_of_phrases, text_fragment_absorber_search_and_add_hyperlink, text_fragment_absorber_search_styled_text, text_fragment_absorber_search_and_highlight |
+| working_with_text | example_text_tooltip | `examples/working_with_text/example_text_tooltip.py` | yes | yes | add_tool_tip_to_searched_text, create_hidden_text_block |
+| working_with_vector_graphics | example_vector_graphics | `examples/working_with_vector_graphics/example_vector_graphics.py` | yes | yes | using_graphics_absorber, move_graphics, remove_graphics_method_1, remove_graphics_method_2, add_to_another_page_method_1, add_to_another_page_method_2 |
+
+## Parse Errors
+
+| Path | Error |
+| --- | --- |
+| `examples/facades/stamp/rotating-stamp-about-the-center-point_1.py` | SyntaxError: unexpected EOF while parsing (line 53) |