[PR #2328] [MERGED] fix: ensure PDF form appearance streams have required /Subtype /Form entry #2219

Closed
opened 2026-02-26 20:32:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2328
Author: @Mythie
Created: 12/16/2025
Status: Merged
Merged: 12/16/2025
Merged by: @Mythie

Base: mainHead: fix/pdf-form-flattening-corruption


📝 Commits (1)

  • fb1fd1d fix: ensure PDF form appearance streams have required /Subtype /Form entry

📊 Changes

1 file changed (+35 additions, -0 deletions)

View changed files

📝 packages/lib/server-only/pdf/flatten-form.ts (+35 -0)

📄 Description

When flattening PDF forms, some appearance streams lack the required
/Subtype /Form dictionary entry needed when used as XObjects. This causes
corruption in Adobe Reader which fails to render these flattened fields.

Per PDF spec, Form XObject streams require:

  • /Subtype /Form (required)
  • /FormType 1 (optional)

The normalizeAppearanceStream function ensures these entries exist before
adding appearance streams as XObjects to the page content stream.

Fixes rendering issues where flattened fields don't display in PDF viewers.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2328 **Author:** [@Mythie](https://github.com/Mythie) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/16/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `fix/pdf-form-flattening-corruption` --- ### 📝 Commits (1) - [`fb1fd1d`](https://github.com/documenso/documenso/commit/fb1fd1d6782b244922d4c0893a6805a9c7d9442f) fix: ensure PDF form appearance streams have required /Subtype /Form entry ### 📊 Changes **1 file changed** (+35 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/lib/server-only/pdf/flatten-form.ts` (+35 -0) </details> ### 📄 Description When flattening PDF forms, some appearance streams lack the required /Subtype /Form dictionary entry needed when used as XObjects. This causes corruption in Adobe Reader which fails to render these flattened fields. Per PDF spec, Form XObject streams require: - /Subtype /Form (required) - /FormType 1 (optional) The normalizeAppearanceStream function ensures these entries exist before adding appearance streams as XObjects to the page content stream. Fixes rendering issues where flattened fields don't display in PDF viewers. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2219
No description provided.