Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
8.7.4
Detailed description of issue
I have registered a license key for my testing domain aca-front.test but watermarks are still visibles
I wish to know if it is related to using Annotations for highlight search results. And if it is the case, is there a way to do it without using ‘plus’ features?
Edit: I have remove all references to Annotations and annotationManager but watermarks are still there.
Expected behaviour
Display pdf with search results without watermarks
Does your issue happen with every document, or just one?
in every document
Link to document
{Provide a link to the document in question if possible}
Code snippet
{Provide a relevant code snippet}
Hi there,
Thank you for contacting us.
Please make sure you correctly place the license key inside the WebViewer constructor:
One other thing to note is that an internet connection is required to verify the license key. If a user loses connection to the internet a watermark might be displayed.
Also, are there any console errors? Please provide screenshots.
Best Regards,
Darian
Hi Darian, thank you for your input.
I’m using a free license understanding that it is enough for only display pdfs online without any other feature like generation, annotation, comments, etc.
I’ve downloaded PDFJS Express v8.7.4 and using it with the following code:
<div id="viewer"></div>
<script type="text/javascript">
WebViewer({
path: 'lib', // path to the PDF.js Express'lib' folder on your server
licenseKey: 'aFfhA7nPinTlEZDvNjvp',
// initialDoc: '/path/to/my/file.pdf', // You can also use documents on your server
}, document.getElementById('viewer'))
.then(instance => {
instance.UI.disableElements(['ribbons', 'notesPanel', 'commentsButton']);
instance.UI.disableElements(['toolsHeader', 'annotationCommentButton', 'contextMenuPopup']);
instance.UI.disableElements(['panToolButton', 'selectToolButton', 'toolsButton']);
instance.UI.setToolbarGroup('toolbarGroup-View');
instance.UI.loadDocument(base64ToBlob('<?php echo $pdfBase64; ?>'), { filename: "Edicion-<?php echo $id;?>.pdf" });
const {
documentViewer,
} = instance.Core;
<?php if ($query): ?>
documentViewer.addEventListener('documentLoaded', () => {
const searchValue = '<?php echo $query; ?>'
const searchMode = instance.Core.Search.Mode.PAGE_STOP | instance.Core.Search.Mode.HIGHLIGHT;
const searchOptions = {
fullSearch: true,
}
// start the search
instance.UI.searchTextFull(searchValue, searchMode, searchOptions);
});
<?php endif; ?>
});
function base64ToBlob(base64) {
const binaryString = window.atob(base64);
const len = binaryString.length;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; ++i) {
bytes[i] = binaryString.charCodeAt(i);
}
return new Blob([bytes], { type: 'application/pdf' });
};
</script>
Hi there,
Please make sure your key is registered to the right domain. Please enter your root domain (for example, “.com”).
Hi Darian, I have registered my local testing domain and I’m using that key in my tests
Registered Key for aca-front.test
Screenshoto from pdf in aca-front.test
My local test server has enough internet connection because pdf data is transferred as base64 stream from an external api
Thanks!
Hi there,
Could you try clearing your cache and see if that resolves the issue? Please also provide network logs.