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

Main to DEV - Fixes in watermark task #1161

Merged
merged 7 commits into from
Sep 19, 2024
8 changes: 4 additions & 4 deletions web/src/components/FOI/Home/Redlining.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,16 +1339,16 @@ const Redlining = React.forwardRef(
if (docInstance && documentList.length > 0) {
const document = docInstance?.UI.iframeWindow.document;
document.getElementById("create_response_pdf").addEventListener("click", handleCreateResponsePDFClick);
docViewer.setWatermark({
docViewer?.setWatermark({
// Draw custom watermark in middle of the document
custom: (ctx, pageNumber, pageWidth, pageHeight) => {
// ctx is an instance of CanvasRenderingContext2D
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
// Hence being able to leverage those properties
let originalPage = pageMappedDocs['stitchedPageLookup'][pageNumber]
let doc = pageFlags.find(d => d.documentid === originalPage.docid);
let pageFlag = doc.pageflag.find(f => f.page === originalPage.page);
if (pageFlag.flagid === pageFlagTypes["Duplicate"]) {
let pageFlag = doc?.pageflag?.find(f => f.page === originalPage.page);
if (pageFlag?.flagid === pageFlagTypes["Duplicate"]) {
ctx.fillStyle = "#ff0000";
ctx.font = "20pt Arial";
ctx.globalAlpha = 0.4;
Expand All @@ -1360,7 +1360,7 @@ const Redlining = React.forwardRef(
ctx.restore();
}

if (pageFlag.flagid === pageFlagTypes["Not Responsive"]) {
if (pageFlag?.flagid === pageFlagTypes["Not Responsive"]) {
ctx.fillStyle = "#ff0000";
ctx.font = "20pt Arial";
ctx.globalAlpha = 0.4;
Expand Down
Loading