Hi,
I cannot get signatures on the PDF files to show.
I have already tried different versions (4.x.x and 5.x.x) of the ngx-extended-pdf-viewer library and none of them seems to be working properly.
I am using a clean Angular project for the tests. The entire project, including the pdf file I'm using, is uploaded here:
Is there some additional config that I am missing?
You're right. The feature is broken. That's a side effect of form support. If you don't need form support, you can display the signature:
export class AppComponent {
public document1 = '/assets/pdf_file.pdf';
constructor() {
pdfDefaultOptions.renderInteractiveForms = false;
}
}
@timvandermeij I believe that's a bug of pdf.js itself. As far as I can the, the signature annotation is detected correctly, but it's never drawn. Any suggestions?
Thanks @stephanrauh for the blazing fast answer.
At this point I do not need form support for my project.
The solution you provided works for me!
That's great news! I hope I can solve the bug nonetheless. But I don't have too much hope - the bug occurs somewhere in the depths of the core library, and that's source code I don't understand yet. On the other hands: how many PDF forms are there that are signed before filling? So maybe the workaround is good enough for most developers.
Digital signatures are deliberately disabled in PDF.js. The reason is that digital signature verification is not implemented, and quite complex to do, and we hide the digital signatures because showing unverified digital signatures gives a false sense of security. This thread and comment tracks the issue and summarizes the problem very well: https://github.com/mozilla/pdf.js/issues/1076#issuecomment-616759554
Until digital signature verification is implemented, PDF.js does not support showing unverified digital signatures.
Yes, I know the ticket and the discussion there. But I'm also under the impression you've prepared displaying signatures so you can activate them after solving the verification problem. It took only a small modification to show them (and I went into great lengths to make developers aware the signature is not verified). So I'm a bit surprised the signatures are shown (with my modification) when I disable form support, but vanish as soon as I activate form rendering.
Hm, not sure, but from the PDF.js perspective it's not supposed to work in either case; see https://github.com/mozilla/pdf.js/blob/master/src/core/annotation.js#L967-L974 that explicitly disables it regardless of whether form support is enabled or not. Moreover, by default unclassified widget annotations (to which signatures belong because we don't parse them) are not rendered by default; see https://github.com/mozilla/pdf.js/blob/4b4ac8a13d9f0f4ed5a20535c5c5c67f37d0a01f/src/display/annotation_layer.js#L133. Hence I can only guess that the customization here is causing this effect, and if not it's only a coincidence that it worked before (even though we did not make any changes to this on purpose lately). For the form support there were quite a lot of changes, but not really anything that should impact signatures as far as I can tell.
@timvandermeij IMHO it's a good thing you're looking at the problem from the pdf.js perspective. Firefox is used by millions and millions of people, so there's little headroom for experiments. BTW, did I already tell you your form support was mentioned in the current copy of the c't? I'm afraid, there's no link (apart from https://www.heise.de/ct/ctmagazin/). The article is print only. Nonetheless: Congratulations!
So even if I allow myself to dig out unsupported features from pdf.js, I fully understand - and support - your careful approach. I'm happy you're helping us at all!
so there's little headroom for experiments
Indeed, that's the exact reason. We're very careful with signatures until we have the means to verify them, otherwise it gives a false sense of security. Given that the issue is open, we're considering the feature; there have been some attempts at implementing it before, but it's a lot of work to get right. Of course you're free to adapt this behavior in a custom integration, and I think there have even been projects that implemented a subset of the signature validation in PDF.js for their specific purpose, so the library itself can be extended to allow it, it's just not something we're involved with right now.
did I already tell you your form support was mentioned in the current copy of the c't
I wasn't aware of that, but that's really interesting! There is also a Dutch version of c't, but I believe it has different contents compared to the German version, so unfortunately it's not a direct translation. In any case: _Vielen Dank, dass du das mit uns geteilt hast!_ :-)
I'm happy you're helping us at all!
I'm happy to help, and sometimes such questions provide possibilities to improve PDF.js to simplify integrations, so that's also helpful for us.
@steffensbola I'd like to use your PDF file in the showcase. Do you allow me to do so? Or can you send me a different file?
Ideally I need two files: one with a valid signature, and a second document with an invalid signature (because I want to show the dangers of using signatures with pdf.js).
Your e-mail address is visible in the signature. Most of the time, that's not a problem, but if a spammer get your address, you might have to give it up.
@stephanrauh feel free to use it.
Thanks!
I've added the signature demo to the showcase. I've also added a warning that the signature can't be verified. It's an important topic, so currently the warning is screaming red. If that's too deterrent, just tell me.


Here's the URL of the demo: https://pdfviewer.net/signatures
I'm closing the ticket because the "red-bar" feature has already landed in version 5.4.0-beta.1 and the signatures are documented at https://pdfviewer.net/signatures.