Skip to content

Add support for selecting font families when creating a form PDF#312

Open
jdalrymple wants to merge 5 commits into
alam00000:mainfrom
jdalrymple:feat/embed-font
Open

Add support for selecting font families when creating a form PDF#312
jdalrymple wants to merge 5 commits into
alam00000:mainfrom
jdalrymple:feat/embed-font

Conversation

@jdalrymple

@jdalrymple jdalrymple commented Dec 27, 2025

Copy link
Copy Markdown

Description

When a user creates a PDF form, they can now select the font family used for the text fields.


New Form Properties area shows all embedded fonts

Screenshot 2025-12-26 at 6 42 09 PM

Font families drop down shows all standard fonts available, and defaults to Helvetica

Screenshot 2025-12-26 at 6 42 25 PM

Adding Custom Font modal

By Google font name
Screenshot 2025-12-26 at 6 42 43 PM

By font URL
Screenshot 2025-12-26 at 6 42 53 PM

By uploaded file
Screenshot 2025-12-26 at 6 43 01 PM

Updated font list after custom font addition

Screenshot 2025-12-26 at 6 44 04 PM

Updated live render / output font render in the pdf

Screenshot 2025-12-26 at 6 44 22 PM Screenshot 2025-12-26 at 6 44 59 PM

Embedded font information

Screenshot 2025-12-26 at 6 51 51 PM

Fixes #261

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

🧪 How Has This Been Tested?

Please describe how you tested your changes so that maintainers can verify them. Include enough detail for someone else to reproduce your tests.

  • Ran through different scenarios manually to ensure the fonts were embedded property & rendered properly
  • Added unit tests

Checklist:

  • Verified output manually
  • Tested with relevant sample documents or data
  • Wrote Vite Test Case (if applicable)

Expected Results:

  • Validate the font parser
  • Validate the custom font modal

Actual Results:

  • They pass...?

Checklist:

  • I have signed the Contributor License Agreement (CLA) or my organization has signed the Corporate CLA
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
@github-actions

github-actions Bot commented Dec 27, 2025

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jdalrymple

Copy link
Copy Markdown
Author

(Still adding tests)

Comment thread .gitignore Outdated
lerna-debug.log*

node_modules
dist

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid commiting the package output

const STANDARD_FONT_NAMES: string[] = Object.values(StandardFonts)

// Additional fonts storage
let additionalFonts: string[] = []

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a better way to do this, im open to suggestions

label.style.fontFamily = fontName.includes('Times') ? 'serif' :
fontName.includes('Courier') ? 'monospace' : 'sans-serif'

// Count how many fields use this font

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be useful 🤔

@jdalrymple

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Dec 27, 2025
@jdalrymple jdalrymple marked this pull request as ready for review December 27, 2025 00:51
@jdalrymple

Copy link
Copy Markdown
Author

I can try and resolve the new conflicts after this has been reviewed

@alam00000

Copy link
Copy Markdown
Owner

@jdalrymple lgtm. could you pleas resolve the conflicts so I may merge it. thank you

@MrFreePress

Copy link
Copy Markdown

Closing as stale/conflicting. If this idea still matters, please reopen it as a fresh PR rebased on current main.

syed211198 pushed a commit to syed211198/HTSbentopdf that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants