I have a multi-format document viewer, in which, for displaying PDFs, I use PF Extension's p:documentViewer
component. The backing bean that supplies the StreamedContent of the PDF is phase rendered and is working as expected. However, though the PDF itself gets rendered fine, the viewer doesn't display the digital signatures in it. Do I need to add any extra configurations to the p:documentViewer
while using it? Here is my usage of it:
<pe:documentViewer id="pdfVw" height="600" width="800" value="#{viewerController4.pdfDocumentStream}">
<f:param name="id" value="#{viewerController4.currentDocId}" />
</pe:documentViewer>
The backing bean method serving the content of the PDF:
public StreamedContent getPdfDocumentStream() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
return new DefaultStreamedContent();
} else {
String id = context.getExternalContext().getRequestParameterMap().get("id");
Doc doc = pdfDocMap.get(id);
return new DefaultStreamedContent(new FileInputStream(new File(doc.getDocPath())), "application/pdf", doc.getDocName());
}
}
Incidentally, I also have a feature on the UI, to display thumbnails of documents -- in which, for PDFs, I extract the first page using PDFBox and convert that into a PNG image and display within a p:graphicImage
. I observe, that in this image, the digital signature is displayed fine!
I'm on SpringBoot + PF 6.2 + JoinFaces
If you need to display PDF with digital signatures PDF.js does not support it currently and the ticket has been open since 2012.
See: https://github.com/mozilla/pdf.js/issues/1076
I suggest you use these service which is free and runs in the browser to show PDF's with signatures: https://verify.ink/