Print popup watermark reset

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.7.0

Detailed description of issue
Hi Team
we have been testing pdf express print feature. we have couple of questions
1.we want to reset print settings on modal close is there any way programatically to click “reset all settings” in watermark popup(please refer image 1)
2. can we hide “include comments” and “include annotations” using script(please refer image 2)


Expected behaviour
Need an option to reset

Does your issue happen with every document, or just one?
every document

Link to document
NA

Code snippet
NA

Hi there,

You can set a default print options via:
https://pdfjs.express/api/UI.html#.setDefaultPrintOptions__anchor

If you want to hide include comments/annotations, you can do this by customizing the UI:

best regards,
Kevin Kim

Hi @kkim thanks for update. yeah i was able to set print default options only during initialization. but not when we change the document.for example please have a look on the below code.

WebViewer({
path: ‘lib’, // path to the PDFTron ‘lib’ folder on your server
}, document.getElementById($attrs.inputId))
.then(function (instance) {
$scope.docViewerInstance = instance;
var docViewer = instance.docViewer;
var annotManager = instance.annotManager;

← here its working–>

instance.UI.setDefaultPrintOptions({ includeComments: true, includeAnnotations: true });
$scope.$watch(() => $scope.url, () => {
instance.UI.loadDocument($scope.url);

<–here its not working–>

instance.UI.setDefaultPrintOptions({ includeComments: false, includeAnnotations: false });
});
docViewer.addEventListener(‘documentLoaded’, function () {
});
// docViewer.on(‘documentLoaded’, wvDocumentLoadedHandler(wvInstance));
});

If you want to set the default options when you switch document, could you try adding it in the documentLoaded event to see if that works for you?

Best regards,
Kevin Kim

yeah i tried in the “documentLoaded” event as well still it’s not working.

Thanks for your reply,

It looks like the above API sets a default print option for that instance. Meaning unless the page is refreshed it looks like the options are set.
You could programmatically force the includeAnnotations & includeComments options using printInBackground API
https://pdfjs.express/api/UI.html#.printInBackground__anchor

Best regards,
Kevin Kim

Hey @kkim as you mentioned we implemented a sample printBackground event for printing. but how to add watermark option in printBackground?

There is no watermark option for the printInBackground API, however you could apply the watermark using setWatermark API before printing, see this forum post for more details:

Best regards,
Kevin Kim