Skip to content

File fields of file attachment annotations #468

Open

Description

@yhay81

Context

Split from #227 after rechecking its dependencies. #227 held two halves: the file fields of the document's attachments (ready: #226 is closed), and the file fields of file attachment annotations, which need those annotations (#162). The halves share the validation and the bounds.

Goal

The file name, description, and creation and modification dates of a file attachment annotation's file specification are assignable and removable as in pylopdf, and writing data sets the modification date.

Scope

In: the annotation side of ISO 32000-2, 7.11.3 and 7.11.4, direct or indirect file specifications, with the validation and bounds that #227 implements for attachments. Out: attachments (#227), the annotation itself (#162).

Paths

  • python/pyropdf/_annotations.py;
  • crates/pyropdf-engine/src/attachments/ and crates/pyropdf-engine/src/annotations/;
  • tests/test_file_fields.py.

Acceptance

  • The annotation cases of pylopdf ebb01d3c's test_file_fields.py are ported and pass, with the intended differences listed.

Notes

Reuse the field checks of #227 instead of repeating them. Split test_file_fields.py by case between #227 and this issue when claiming.

Activity

  1. added
    area:enginecrates/pyropdf-engine: interpretation, rendering, writing, understanding
    area:pythoncrates/pyropdf-python and python/pyropdf: the binding and the Python API
    on Oct 31, 2026
  2. yhay81 commented on Nov 1, 2026

    @yhay81
    OwnerAuthor

    Review note: the current annotation _file_texts calls overridable len and encode methods on str subclasses. A subclass can report a small size or empty encoded bytes and bypass embedded_file_input_size. When reusing #227 validation, use the built-in string methods for the bound and add a regression with overridden methods as well as oversized Unicode input.

  3. yhay81 commented on Nov 1, 2026

    @yhay81
    OwnerAuthor

    Also normalize validated string-subclass values to a built-in str before writing: the object encoder otherwise calls the subclass encode again, which can change validated content during serialization. The #535 review added coverage for this path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:enginecrates/pyropdf-engine: interpretation, rendering, writing, understandingarea:pythoncrates/pyropdf-python and python/pyropdf: the binding and the Python API

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions