The background Color selection should not influence print

Product: PDFTron

Product Version: pdftron/webviewer: “8.3.0”,

We have done some changes to change the background color for the file attached to the document using the updateRasterizerOptions API. Please find below the sample code.

private setDefaultPageColorAndRefreshView(pageView: IVpmnToolbarDropDownItem): void {
if (pageView.id === “Black”) {
this.pdftron.Core.documentViewer.getDocument().updateRasterizerOptions({ colorPostProcessMode: 3, pageTransparent: false });
} else {
this.pdftron.Core.documentViewer.setDefaultPageColor(pageView.id);
this.pdftron.Core.documentViewer.getDocument().updateRasterizerOptions({ colorPostProcessMode: 0 });
}
this.pdftron.Core.documentViewer.refreshAll();
this.pdftron.Core.documentViewer.updateView();
}

This works good but when i change the background color to black the print functionality gets influenced. Right now when I select Black, the print is also in black which is not right. When i change the bg color to Grey and then issue a print then the print is in default view , we see two different behaviors here.

Expectation is the background color should not influence the print and should print with the default view.

Please let us know how can we get around this issue.

Thanks & Regards,
Manish Agarwal

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello @magarwal2507

Changing the background with that rasterizer option is actually expected to change the printed version.

There are two possible workarounds that I can think of, but you would need to fork and customize the UI for both:

1 - Create a document in-memory based on the loaded document, but apply the rasterizer options reverted before sending it to be printed.
2 - Apply the reverted options to the loaded document, send it to print, and reapply the background after printing.

Here are the relevant APIs and files: