Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web and pdflib enhancements #219

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Web and pdflib enhancements #219

merged 1 commit into from
Jan 10, 2024

Conversation

dcbr
Copy link
Collaborator

@dcbr dcbr commented Dec 29, 2023

Awesome library! I would like to use it for web applications, in combination with the pdf-lib library, for which following enhancements are required or useful.

Overview

  • [Web]: As there is no node:Buffer type, web applications are not supported right now (type error). This PR accepts beside the Buffer also the Uint8Array (both available in Node and Web applications) and string (base64 encoded bytes) types when signing a pdf or creating a P12Signer. An extra utility function convertBuffer is introduced for this.
  • [Pdflib]: The pdflib placeholder now accepts a PDFDocument or PDFPage input, supporting signatures on other pages than the first one.
  • [Pdflib]: The pdflib placeholder now accepts a signingTime input, such that it can be matched with the document creation or modification time.
  • [Pdflib]: The pdflib placeholder inserts the signature dictionary as a PDFInvalidObject, such that it is not serialized in an object stream. This means the {useObjectStreams: false} is no longer needed when saving the document (and thus compressing the final signed pdf size).
  • [Pdflib]: The pdflib placeholder inserts an appearance stream dictionary for the signature widget, which is required for PDF/A compliance.
  • [Pdflib]: The pdflib placeholder inserts a Prop_Build dictionary for the signature. Allowing to specify which filter and application were used to generate the signature.
  • [Sign]: The sign function and Signers have an extra signingTime input, such that it can be matched with the document creation or modification time.

@dcbr dcbr marked this pull request as ready for review December 30, 2023 22:29
@vbuch
Copy link
Owner

vbuch commented Jan 2, 2024

Reading through your description, this seems like an exciting contribution. I'll give it a more thorough look in the coming days but I love every word of the description.

Copy link
Owner

@vbuch vbuch left a comment

Choose a reason for hiding this comment

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

All looks great and in line with what we've been doing so far. Thank you for a great contribution.

packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js Outdated Show resolved Hide resolved
@vbuch vbuch merged commit 474152b into vbuch:develop Jan 10, 2024
1 check passed
@vbuch
Copy link
Owner

vbuch commented Jan 10, 2024

I'll get that released today or tomorrow. Thank you for a great contribution!

@vbuch vbuch mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants