ng2-pdfjs-viewer icon indicating copy to clipboard operation
ng2-pdfjs-viewer copied to clipboard

PDF open but signature not displaying.

Open Paul75 opened this issue 4 years ago • 4 comments

hello,

I have a PDF it read but not all in document appear. In the document I have a signature that not display. It display good with app Adobe Acrobat Reader. With other (only test one) ng2-pdf-viewer it display good ...

Thanks

Paul75 avatar Aug 08 '20 15:08 Paul75

Can you try with mozilla's pdf.js directly. This angular component uses pdf.js behind the scenes

codehippie1 avatar Feb 28 '21 04:02 codehippie1

@Paul75 Also, can you send me the file you are trying with?

codehippie1 avatar Feb 28 '21 04:02 codehippie1

Hi @Paul75 !

This library uses a local copy of PDF.js underneath. Currently, this copy is of PDF.js v2.2.171, which is the cause of your problem: PDF.js didn't display Digital Signature Widgets until v2.9.359 (implemented on pull request #13214).

In order to display digital signatures, you'll have to use your own version of pdf.worker.js (I'm still studying this library's code, so I don't know if there's a simple way of doing it), with a minor modification:

@@ -28213,8 +28213,9 @@ function () {
             case 'Ch':
               return new ChoiceWidgetAnnotation(parameters);
           }
-
-          (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
+          if (fieldType !== 'Sig') {
+            (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
+          }
           return new WidgetAnnotation(parameters);
 
         case 'Popup':
@@ -28684,7 +28685,7 @@ function (_Annotation) {
     if (data.fieldType === 'Sig') {
       data.fieldValue = null;
 
-      _this2.setFlags(_util.AnnotationFlag.HIDDEN);
+      // _this2.setFlags(_util.AnnotationFlag.HIDDEN);
     }
 
     return _this2;

From what I've seen so far, you'll have to assign the path of your worker to PDF.js:

import * as PDFJS from 'path/to/pdfjs/build/pdf';

PDFJS.GlobalWorkerOptions['workerSrc'] = 'path/to/your/worker.js';

Cheers!

LAlves91 avatar Aug 16 '21 15:08 LAlves91

Hi guys, I have a similar issue for one of my project.

Do you know if it is related to the use of an old version of PDF.js ? Is there a workaround for this issue ?

Let me know if I can be of any help :P Cheers Pierre

clainchoupi avatar Mar 28 '22 09:03 clainchoupi