How to use the pdfjs-dist/web/pdf_viewer.PDFLinkService 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 / pdfviewer.ts View on Github external
async function createPDFViewer() {

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

    const container = document.getElementById('viewerContainer');

    if (! container) {
        throw new Error("No container");
    }

    const pdfLinkService = new PDFLinkService();

    // the text area is working!
    //
    // FIXME: I think I ahve to specify a custom RenderingQueue here because right now it renders ALL the pages...
    //
    //     // and I need to limit this to say += 10 pages..
    //
    //     // FIXME: how do we change the zoom
    //
    //     // FIXME: how do we render the thumbnails
    //
    // FIXME: center the page properly
    // FIXME make sure all the background and spacing is proper on the PDF

    const pdfViewer = new PDFViewer({
        container: container as HTMLDivElement,
github agentcooper / react-pdf-highlighter / src / components / PdfHighlighter.js View on Github external
componentDidMount() {
    const { pdfDocument } = this.props;

    this.debouncedAfterSelection = _.debounce(500, this.afterSelection);
    this.linkService = new PDFLinkService();

    this.viewer = new PDFViewer({
      container: this.containerNode,
      enhanceTextSelection: true,
      removePageBorders: true,
      linkService: this.linkService
    });

    this.viewer.setDocument(pdfDocument);
    this.linkService.setDocument(pdfDocument);
    this.linkService.setViewer(this.viewer);

    // debug
    window.PdfViewer = this;

    document.addEventListener("selectionchange", this.onSelectionChange);