How to access OCR module in webviewer

WebViewer Version: 11.9.0

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? Yes
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? No

Please give a brief summary of your issue:
I want to enable OCR module in webviewer.

Please describe your issue and provide steps to reproduce it:
I want to enable OCR module in webviewer. I’ve install the data-extraction. when I try to access the OCR module in webviewer getting “Undefined”.
I have add code for your reference:

    initilize: function () {
        $('.common-loading-spinner-text').text('Please do not close your browser or press the back button until the document has fully loaded.');
        $('.common-loading').show();
        WebViewer.Iframe({
            path: '/GovBuilt.PlanReview/webviewer',
            licenseKey: Apryse.licenseKey,
            initialDoc: !Apryse.isForntEndDoc ? Apryse.pdffilepath : null,
            loadSpinner: false,
            annotationUser: this.userId,
            compareDefaultLayout: Apryse.compareDefaultLayout,
            permissions: Apryse.permissions,
            fullAPI: true,
            UI: 'Modular',
            enableDataExtraction: true, 
            css: '/GovBuilt.PlanReview/css/viewer.min.css',
        }, document.getElementById(Apryse.viewerId))
            .then((instance) => {
                window.webViewerInstance = instance;
                core = instance.Core;
                const { documentViewer, annotationManager, Annotations } = instance.Core;
                const { Feature } = instance.UI;
                const { Color } = Annotations;
                const { PDFNet, Tools, OCRModule } = instance.Core;
                console.log(PDFNet.OCRModule);
                console.log(OCRModule);
                const UIEvents = instance.UI.Events;

I have use npm to download:

 {
   "sources": [
     "node_modules/@pdftron/webviewer/public"
   ],
   "target": "wwwroot/webviewer/"
 },
 {
   "sources": [
     "node_modules/@pdftron/data-extraction/lib"
   ],
   "target": "wwwroot/webviewer/core/extraction/"
 },

My folder structure look like:
GovBuilt.Products\GovBuilt.PdfReview\wwwroot\webviewer\core\extraction

let me the way to access the ocr Module for the webviewer. I tried the document but there I got confused.

Hello, I’m AiRon, an automated tech support bot :robot: While you wait for one of our customer support representatives, I can help you with your question.


It seems like you’re trying to access the OCR module in WebViewer, but you’re encountering an “Undefined” error. This usually means that the OCR module isn’t properly loaded or initialized. Let’s go through some steps to ensure everything is set up correctly.

Some things you can try:

  • Ensure that the OCR module is included in your WebViewer setup. It should be part of the data-extraction package, and you need to specify its path correctly.

  • Check that the OCR module is being initialized after WebViewer itself. The OCRModule should be available after the WebViewer instance is fully initialized.

  • Verify that the paths to your data-extraction files are correct and that the files are being served properly from your server.

  • Make sure the license key you are using has access to the OCR module. Some features require specific licensing.

  • Ensure that you’re using the correct API calls to access the OCR module. It should be accessed through instance.Core.OCRModule.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

Hello Rishu,

Thank you for contacting WebViewer Forums.

The OCR module is not available on WebViewer and is performed using the Server SDK. There are a limited amount of APIs on WebViewer regarding OCR but the extraction itself is not supported; only with the Server SDK. More information can be found here: OCR Library, Server / Desktop, free trial | Apryse documentation

Regards,
Luke

1 Like