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

Signature element is not rendered #14647

Closed
GeorgeTailor opened this issue Mar 8, 2022 · 4 comments
Closed

Signature element is not rendered #14647

GeorgeTailor opened this issue Mar 8, 2022 · 4 comments

Comments

@GeorgeTailor
Copy link

GeorgeTailor commented Mar 8, 2022

Attach (recommended) or Link to PDF file here:
JSFiddle with base64 encoded PDF

Configuration:

  • Web browser and its version: Chrome 98
  • Operating system and its version: Mac
  • PDF.js version: latest
  • Is a browser extension: no

Steps to reproduce the problem:

  1. run the fiddle
  2. signature element does not have background color nor borders, it's invisible compared to text fields

What is the expected behavior? (add screenshot)
Signature element should be rendered the same way as text field

What went wrong? (add screenshot)
normally text field has the following properties:

date: Array(1)
0:
actions: null
charLimit: null
comb: false
defaultValue: null
editable: true
fillColor: null
hidden: false
id: "29R"
multiline: false
name: "date"
page: 0
password: false
rect: (4) [142.511, 599.779, 292.511, 621.779]
strokeColor: null
type: "text"
value: ""
[[Prototype]]: Object
length: 1

but the signature one has only a limited subset:

Signature25: Array(1)
0:
id: "28R"
page: 0
type: "signature"
value: null
[[Prototype]]: Object
length: 1
[[Prototype]]: Array(0)

Is there a workaround for the time being while this issue is not resolved?

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Mar 8, 2022

Attach (recommended) or Link to PDF file here:

Please always directly attach the PDF document itself here, since that saves peoples time (compared to having to manually download it from a JSFiddle).

PDF.js version: latest

For future reference: Please always provide a version number, since "latest" is of limited usefulness in general.

What went wrong? (add screenshot)
normally text field has the following properties:

But this clearly isn't a "normal" text field...

What is the expected behavior? (add screenshot)
Signature element should be rendered the same way as text field

There's actually no meaningful appearance-stream data for that signature Annotation, which is why nothing is rendered. Note also that we actually match the rendering in e.g. PDFium (in Google Chrome) here.

but the signature one has only a limited subset:

Yes, this is somewhat expected since we currently don't support anything except displaying signature Annotations (assuming they actually contain appearance-stream data). Exposing additional properties is effectively blocked by issue #13351, since what we expose through the API need to be validated in order to prevent errors.


Closing as answered, or possible just a duplicate of #13351.

@GeorgeTailor
Copy link
Author

GeorgeTailor commented Mar 8, 2022

Not really, maybe I've misspoke. The only thing that we would really need is at least the position of that element, and rect property is not present for signature field at all. @Snuffleupagus

@Snuffleupagus
Copy link
Collaborator

The only thing that we would really need is at least the position of that element, and rect property is not present for signature field at all.

Yes it is, if you look at the data returned by the getAnnotations method that's available on PDFPageProxy-instances; see

pdf.js/src/display/api.js

Lines 1301 to 1306 in 3e593cf

/**
* @param {GetAnnotationsParameters} params - Annotation parameters.
* @returns {Promise<Array<any>>} A promise that is resolved with an
* {Array} of the annotation objects.
*/
getAnnotations({ intent = "display" } = {}) {

@GeorgeTailor
Copy link
Author

@Snuffleupagus ok, I can see that annotations for signatures are really there but I don't see a way to verify it since it's (probably ?) just a white block on a white canvas and svg rendering is not supported anymore. Is there any docs regarding modification of visual representation of such elements? I mean adding background color and/or border and some text somewhere near?

I've looked through the docs but haven't found anything and Matrix room doesn't seem to work at all.

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

No branches or pull requests

2 participants