4 add examples in facades section#6
Conversation
- Created a new FDF file with form data for "First Name", "Last Name", "City", and "Country". - Added a JSON representation of the form data with corresponding field names and values. - Introduced an XFDF file containing the same form data structured in XML format. - Generated an XML file with the form fields and their respective values.
…ation in facades section
…leting, extracting, inserting, making booklets, making n-up, adding page breaks, and splitting PDF pages.
…rations, PDF composition, and security
…proving field manipulation methods
…placing text in PDF documents
…m/aspose-pdf/Aspose.PDF-for-Python-via-.NET into 4-add-examples-in-facades-section
…m/aspose-pdf/Aspose.PDF-for-Python-via-.NET into 4-add-examples-in-facades-section
…improve documentation
…m/aspose-pdf/Aspose.PDF-for-Python-via-.NET into 4-add-examples-in-facades-section
- Implemented functions for creating booklets, adding margins, resizing contents, and managing pages in PDF documents. - Added error handling for booklet and N-Up creation. - Introduced new examples for merging and managing PDF files. - Removed deprecated page operations file.
- Generated a comprehensive index of example scripts across multiple categories, including accessibility, document manipulation, form handling, and more. - Included details such as module paths, available operations, and configuration helpers. - Documented parse errors for specific example scripts to aid in debugging.
- Deleted outdated examples for adding page stamps, text stamps, and image stamps. - Introduced a new example for adding a generic stamp to a PDF. - Added examples for decoding PDF pages and printing large PDF files with various settings. - Removed legacy code for managing headers and footers in PDF documents. - Updated the PDF viewer examples to include printing functionalities and handling multiple documents in a single job. - Added sample PDF file for testing purposes.
- Removed outdated examples for adding image and PDF page stamps. - Introduced a new comprehensive example for adding various types of stamps (image, text, PDF page) in a single script. - Enhanced the PDF viewer examples to include decoding pages and printing with various settings. - Updated the print examples to utilize a viewer class for better management of print settings. - Added new output files for testing and demonstration purposes.
…ities, enhance header examples, and remove outdated stamp example
…; remove outdated PDF attachments
…d remove outdated image path resolution
…om facades section
…ositioning, and update background image settings
…ettings, and add metadata inspection
…n example execution
There was a problem hiding this comment.
Pull request overview
This PR expands the repository’s facades section by adding multiple new example scripts (PdfViewer, PdfFileSignature, PdfContentEditor, PdfFileEditor, Form/FormEditor, PdfFileSecurity, PdfFileInfo, Stamp/PdfFileStamp) along with the required sample_data/facades/ inputs, and introduces .codex skill/config documentation for repository automation guidance.
Changes:
- Added many new facades example scripts under
examples/facades/**plus supporting helper module(s). - Added new sample input assets under
sample_data/facades/**(PDFs, images, form data, attachments). - Added
.codex/**configuration + skills docs; minor cleanup inREADME.md,.gitignore, and a whitespace-only tweak in an existing example.
Reviewed changes
Copilot reviewed 64 out of 166 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| sample_data/facades/stamp/input/logo.png | Adds image asset used by stamp examples |
| sample_data/facades/pdf_content_editor/input/SampleAttachment.txt | Adds attachment payload for attachment examples |
| sample_data/facades/form/input/sample_form_xfa.xml | Adds XFA XML data for form import examples |
| sample_data/facades/form/input/sample_form_image.jpg | Adds image asset for form/button image appearance examples |
| sample_data/facades/form/input/sample_form.xml | Adds XML form data for import/export samples |
| sample_data/facades/form/input/sample_form.xfdf | Adds XFDF form data for import/export samples |
| sample_data/facades/form/input/sample_form.json | Adds JSON form data for import/export samples |
| sample_data/facades/form/input/sample_form.fdf | Adds FDF form data for import/export samples |
| sample_data/facades/form/input/get_rich_text_values_in_data.xml | Adds rich-text XML data sample |
| examples/working_with_documents/example_formatting_pdf_document.py | Minor formatting-only change in examples list |
| examples/facades/stamp/add-stamp.py | New stamp example suite using PdfFileStamp/Stamp facades |
| examples/facades/pdf_viewer/print-pdf-document.py | New PdfViewer printing examples |
| examples/facades/pdf_viewer/print-large-pdf-file.py | New PdfViewer “large file” printing examples |
| examples/facades/pdf_viewer/decode-pdf-pages.py | New PdfViewer page decoding examples |
| examples/facades/pdf_file_stamp/add-stamps-to-pdf.py | New PdfFileStamp stamp example |
| examples/facades/pdf_file_stamp/add-pdf-headers.py | New PdfFileStamp header examples |
| examples/facades/pdf_file_stamp/add-pdf-footers.py | New PdfFileStamp footer examples |
| examples/facades/pdf_file_stamp/add-page-numbers-to-pdf.py | New PdfFileStamp page numbering examples |
| examples/facades/pdf_file_signature/usage-rights-management.py | New PdfFileSignature usage-rights example |
| examples/facades/pdf_file_signature/signature-verification.py | New signature verification examples |
| examples/facades/pdf_file_signature/signature-management.py | New signature removal examples |
| examples/facades/pdf_file_signature/signature-integrity-checks.py | New signature integrity check examples |
| examples/facades/pdf_file_signature/signature-information.py | New signature info extraction examples |
| examples/facades/pdf_file_signature/signature-extraction.py | New signature image/cert extraction examples |
| examples/facades/pdf_file_signature/revision-permissions.py | New revision/permissions examples |
| examples/facades/pdf_file_signature/pdf-signing.py | New signing examples (uses shared helpers + bundled cert) |
| examples/facades/pdf_file_signature/pdf-certification.py | New certification examples (currently has runtime issues) |
| examples/facades/pdf_file_signature/certificate.pfx | Adds certificate file used by signing/certification examples |
| examples/facades/pdf_file_signature/_pdf_file_signature_helpers.py | Shared helper utilities for signature examples |
| examples/facades/pdf_file_security/set-privileges.py | New PdfFileSecurity privilege examples |
| examples/facades/pdf_file_security/encrypt-pdf.py | New PdfFileSecurity encryption examples |
| examples/facades/pdf_file_security/decrypt-pdf.py | New PdfFileSecurity decryption examples |
| examples/facades/pdf_file_security/change-password.py | New PdfFileSecurity password change examples |
| examples/facades/pdf_file_info/pdf-metadata.py | New PdfFileInfo metadata examples |
| examples/facades/pdf_file_info/page-information.py | New PdfFileInfo page info/offset examples |
| examples/facades/pdf_file_info/document-properties.py | New PdfFileInfo document properties examples |
| examples/facades/pdf_file_editor/splitting-pdf-documents.py | New PdfFileEditor splitting examples |
| examples/facades/pdf_file_editor/page-merging.py | New PdfFileEditor concatenation examples |
| examples/facades/pdf_file_editor/page-managment.py | New PdfFileEditor page management examples (filename typo) |
| examples/facades/pdf_file_editor/page-layout-and-margins.py | New PdfFileEditor layout/margins/page-break examples |
| examples/facades/pdf_file_editor/merge-pdf-documents.py | Placeholder file (no runnable example code) |
| examples/facades/pdf_file_editor/booklet-and-nup-layout.py | New PdfFileEditor booklet + N-up examples |
| examples/facades/pdf_content_editor/viewer-preferences.py | New PdfContentEditor viewer-preference examples |
| examples/facades/pdf_content_editor/text-editing.py | New PdfContentEditor text replacement examples |
| examples/facades/pdf_content_editor/stamps.py | New PdfContentEditor stamp management examples |
| examples/facades/pdf_content_editor/multimedia.py | New PdfContentEditor movie/sound annotation examples |
| examples/facades/pdf_content_editor/link-and-navigation.py | New PdfContentEditor link creation/extraction examples |
| examples/facades/pdf_content_editor/images.py | New PdfContentEditor image replacement/deletion examples |
| examples/facades/pdf_content_editor/drawing-annotations.py | New PdfContentEditor drawing annotation examples |
| examples/facades/pdf_content_editor/document-actions.py | New PdfContentEditor document action examples |
| examples/facades/pdf_content_editor/binding-and-streams.py | New PdfContentEditor bind/save stream overload examples |
| examples/facades/pdf_content_editor/attachments.py | New PdfContentEditor attachments examples |
| examples/facades/pdf_content_editor/annotations.py | New PdfContentEditor annotation examples |
| examples/facades/formeditor/modifying-form-fields.py | New FormEditor form-field modification examples |
| examples/facades/formeditor/customizing-field-appearance.py | New FormEditor appearance customization examples (some no-ops) |
| examples/facades/formeditor/creating-form-field.py | New FormEditor field creation examples |
| examples/facades/formeditor/adding_scripts_and_submit_actions.py | New FormEditor script/submit-action examples |
| examples/facades/form/working_with_button_fields.py | New Form facade button-field examples |
| examples/facades/form/reading-and-inspecting-form-data.py | New Form facade inspection examples |
| examples/facades/form/managing-pdf-form-fields.py | New Form facade flatten/rename examples |
| examples/facades/form/importing_pdf_form_data.py | New Form facade import examples (XML/FDF/XFDF/JSON/XFA) |
| examples/facades/form/filling_form_fields.py | New Form facade “fill fields” examples |
| examples/facades/form/exporting_pdf_form_data.py | New Form facade export examples |
| README.md | Minor formatting + method name correction in docs |
| .gitignore | Ignores .vscode workspace files |
| .codex/skills/pdf-operations/SKILL.md | Adds local “skill” documentation for pdf operations patterns |
| .codex/skills/code-style/SKILL.md | Adds local “skill” documentation for code style conventions |
| .codex/config.yaml | Adds Codex configuration for the repo |
| .codex/SKILLS.md | Adds skills index documentation |
| from _pdf_file_signature_helpers import ( | ||
| DEFAULT_INPUT_PDF, | ||
| create_pdf_file_signature, | ||
| create_doc_mdp_signature, | ||
| create_pdf_file_signature, | ||
| create_signature_rectangle, | ||
| ) |
There was a problem hiding this comment.
The import list from _pdf_file_signature_helpers includes create_pdf_file_signature twice, which is redundant and can confuse readers about what’s intended. Remove the duplicate import to keep the module clean.
| viewer = pdf_facades.PdfViewer() | ||
| viewer.auto_resize = True | ||
| viewer.auto_rotate = True | ||
| viewer.auto_rotate_mode = pdf_facades.AutoRotateMode.NONE | ||
| viewer.print_page_dialog = False | ||
| viewer.print_as_image = False | ||
| viewer.print_as_grayscale = False | ||
| viewer.use_intermidiate_image = True | ||
| viewer.printer_job_name = "Aspose.PDF Large File Print" | ||
| viewer.coordinate_type = ap.PageCoordinateType.CROP_BOX |
There was a problem hiding this comment.
auto_rotate_mode is set using pdf_facades.AutoRotateMode.NONE here, while print-pdf-document.py uses ap.Printing.AutoRotateMode.NONE. If AutoRotateMode isn’t exposed on aspose.pdf.facades, this will raise an AttributeError at runtime. Consider using the same enum namespace consistently across viewer examples (whichever is correct for the Python binding).
| 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), | ||
| ] |
There was a problem hiding this comment.
pdf-certification.py references set_certificate_for_signing in the examples list, but that function is not defined or imported in this module, so run_all_examples() will raise a NameError. Either import it (e.g., from pdf-signing.py) or remove that entry / define a local implementation.
| for name, func in examples: | ||
| try: | ||
| output_file = path.join(output_dir, f"{func.__name__}.pdf") | ||
| if func.__name__ in ( | ||
| "add_image_stamp", | ||
| "add_stamp_to_specific_pages", | ||
| "add_background_image_stamp", | ||
| ): | ||
| func(input_pdf, image_file, output_file) | ||
| elif func.__name__ == "add_pdf_page_as_stamp": | ||
| func(input_pdf, input_pdf, output_file) | ||
| else: | ||
| func(input_pdf, output_file) | ||
| print(f"✅ Success: {name}") |
There was a problem hiding this comment.
The output naming here deviates from the repo’s common {function_name}_out.pdf pattern used throughout other examples, which makes outputs harder to scan and consistent tooling harder. Consider changing the output filename to include the _out suffix (e.g., f"{func.__name__}_out.pdf").
| ("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), |
There was a problem hiding this comment.
Trailing whitespace was introduced at the end of this line. Please remove it to avoid noisy diffs and keep formatting consistent.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/aspose-pdf/Aspose.PDF-for-Python-via-.NET/sessions/8cf07824-ec5b-4034-b688-0eb8f1e565ac Co-authored-by: andruhovski <2671216+andruhovski@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.