Skip to content

Kernel: file attachment annotations #245

Open

Description

@Tim81

The second placement for an embedded file, after the EmbeddedFiles name tree: a file attachment
annotation on a page (§12.5.6.15). /FileAttachment has zero occurrences in the writer.

Scope

/Subtype /FileAttachment, /FS pointing at a file specification (A2), and /Name selecting the
icon — GraphPushPin, PaperclipTag, PushPin or Tag.

The interoperability constraint that shapes the API

AN002 §6.1 recommends linking embedded files through either the EmbeddedFiles name tree or file
attachment annotations, and warns:

If File Attachment annotations are used, an additional entry in the EmbeddedFiles names tree may
mislead some PDF viewers into displaying two entries, so it is strongly advised to use either one
or the other
.

So the API should make the placement an explicit choice at attach time, and should not quietly do
both. A caller who genuinely wants both should have to say so.

The converse matters for reading: AN002 §6.2 says a consumer looking for embedded files "should
therefore analyze the Names tree as well as all annotation entries on all PDF pages" — which is
A6's requirement, recorded here because it is the same constraint seen from the other side.

PDF/UA-2

§8.9.2.4.10: when a file attachment annotation references a file specification dictionary, that
dictionary shall include an /AFRelationship entry. NOTE 2 there adds that using the string form
of a file specification is equivalent to /AFRelationship being Unspecified.

Acceptance

  • Attach a file as an annotation, read it back byte-identically.
  • Attaching to both placements at once either refuses or requires an explicit opt-in — asserted.
  • /AFRelationship present on the referenced file specification.
  • pdfdetach -list sees the attachment exactly once.

Relates to

  • A2 — the file specification.
  • A4 — /AFRelationship.
  • A6 — the reader must check annotations as well as the name tree.
  • A7 — the annotation subtype machinery this uses.

Plan labels used above, resolved: A2 #242 · A4 #243 · A7 #244 · A6 #247.

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

    type/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions