Render page in black and white

Q: How can I render the content of a document in black and white?

A: There’s currently no way to manipulate the colors of the content of a document to render them as black and white.

However, while the document is being viewed on the PSPDFKit for Web viewer, you can make use of CSS to apply the filter property to each individual rendered tile with the grayscale(1) value:

Copy
1
2
3
4
5
6
7
8
.PSPDFKit-Page img {
  filter: grayscale(1);
}

/* Avoid affecting image annotations and other AP streams */
.PSPDFKit-APStream img {
  filter: none;
}

Remember that the PSPDFKit.Configuration#styleSheets option allows you to load your custom CSS style sheets.

This has been tested with PSPDFKit for Web 2020.6.3