How to use the pdfjs-dist/build/pdf.GlobalWorkerOptions function in pdfjs-dist

To help you get started, we’ve selected a few pdfjs-dist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github burtonator / polar-bookshelf / web / spectron0 / ui-components / content-pdfviewer.html View on Github external
findController: this.pdfFindController,
            enhanceTextSelection: true,
            textLayerMode: 2
        });

        // FIXME: the scale is important here too...

        //
        pdfLinkService.setViewer(pdfElement);
        //
        // // Loading document.

        // const url = '../../../docs/examples/pdf/bigtable.pdf';
        const url = '../../../test.pdf';

        pdfjsLib.GlobalWorkerOptions.workerSrc = '../../../node_modules/pdfjs-dist/build/pdf.worker.js';

        const loadingTask = pdfjsLib.getDocument({
            url,
            cMapUrl: '../../../node_modules/pdfjs-dist/cmaps/',
            cMapPacked: true,
            pdfFindController: this.pdfFindController,
        });
        //
        const pdfDocument = await loadingTask.promise;

        pdfElement.setDocument(pdfDocument);
        pdfLinkService.setDocument(pdfDocument, null);
        pdfFindController.setDocument(pdfDocument);

    }
github ntheile / blockusign / BlockUSign.Ionic / src / components / block-pdf / block-pdf.ts View on Github external
$(document).ready(() => {

      this.setCursorFocus(200);

      pdfjsLib.GlobalWorkerOptions.workerSrc = location.origin + "/assets/pdf.worker.js"


      this.loading = this.loadingCtrl.create({
        content: 'Please wait...',
        duration: 12000
      });
      this.loading.present();

      if (this.utils.isMobile()) {
        this.mouseEndEventDeviceSpecific = "touchend"
      }

      this.init();
      document.addEventListener('textAnnotationDropped', this.onTextAnnotationDropped );
    
    });
github gitlabhq / gitlabhq / app / assets / javascripts / pdf / index.vue View on Github external
mounted() {
    pdfjsLib.GlobalWorkerOptions.workerSrc = workerSrc;
    if (this.hasPDF) this.load();
  },
  methods: {