[PR #1086] [MERGED] feat: add prefilling pdf form fields via api #1375

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

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1086
Author: @Mythie
Created: 4/8/2024
Status: Merged
Merged: 4/8/2024
Merged by: @Mythie

Base: mainHead: feat/pdf-field-prefill


📝 Commits (1)

  • 08b693f feat: add prefilling pdf form fields via api

📊 Changes

8 files changed (+128 additions, -0 deletions)

View changed files

📝 packages/api/v1/implementation.ts (+29 -0)
📝 packages/api/v1/schema.ts (+2 -0)
📝 packages/lib/server-only/document/create-document.ts (+3 -0)
📝 packages/lib/server-only/document/send-document.tsx (+36 -0)
packages/lib/server-only/pdf/insert-form-values-in-pdf.ts (+54 -0)
📝 packages/lib/server-only/template/create-document-from-template.ts (+1 -0)
packages/prisma/migrations/20240408083413_add_form_values_column/migration.sql (+2 -0)
📝 packages/prisma/schema.prisma (+1 -0)

📄 Description

Description

Adds the ability to prefill native PDF form fields via the API using either normal documents or templates.

Since we won't always know when a document is uploaded and has forms we opt to do this on creation for templates and on sending the document to recipients in all cases. This means that for a created document it can look a little funky since the form fields are missing the data until the document is sent.

This should be improved in a later change but since we've scoped this to an API only workflow for now we are less concerned with the visual issues.

N/A

Changes Made

  • Added the formValues field the document model
  • Added a new method for finding and filling form fields based on a key | value pair
  • Updated the API input shapes to take the new field.

Testing Performed

  • Have created and tested a document using the API both for creation and usage with a template.
  • Have verified that the fields display as expected either during creation or sending depending on the document type.

🔄 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/1086 **Author:** [@Mythie](https://github.com/Mythie) **Created:** 4/8/2024 **Status:** ✅ Merged **Merged:** 4/8/2024 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/pdf-field-prefill` --- ### 📝 Commits (1) - [`08b693f`](https://github.com/documenso/documenso/commit/08b693ff95a7ddb62db649e9474696f318f0cc1a) feat: add prefilling pdf form fields via api ### 📊 Changes **8 files changed** (+128 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/v1/implementation.ts` (+29 -0) 📝 `packages/api/v1/schema.ts` (+2 -0) 📝 `packages/lib/server-only/document/create-document.ts` (+3 -0) 📝 `packages/lib/server-only/document/send-document.tsx` (+36 -0) ➕ `packages/lib/server-only/pdf/insert-form-values-in-pdf.ts` (+54 -0) 📝 `packages/lib/server-only/template/create-document-from-template.ts` (+1 -0) ➕ `packages/prisma/migrations/20240408083413_add_form_values_column/migration.sql` (+2 -0) 📝 `packages/prisma/schema.prisma` (+1 -0) </details> ### 📄 Description ## Description Adds the ability to prefill native PDF form fields via the API using either normal documents or templates. Since we won't always know when a document is uploaded and has forms we opt to do this on creation for templates and on sending the document to recipients in all cases. This means that for a created document it can look a little funky since the form fields are missing the data until the document is sent. This should be improved in a later change but since we've scoped this to an API only workflow for now we are less concerned with the visual issues. ## Related Issue N/A ## Changes Made - Added the `formValues` field the document model - Added a new method for finding and filling form fields based on a `key | value` pair - Updated the API input shapes to take the new field. ## Testing Performed - Have created and tested a document using the API both for creation and usage with a template. - Have verified that the fields display as expected either during creation or sending depending on the document type. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 19:32:59 +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#1375
No description provided.