A lightweight, reliable PDF viewer for Visual Studio Code, powered by Mozilla PDF.js.
GitHub: mathematic-inc/vscode-pdf
This extension runs the latest pdf.js underneath. Try the PDF.js demo viewer.
Most extensions currently in the marketplace have problems too deep to fix. These problems include memory leaks, outdated dependencies, and several debouncing issues. A priori, this extension does not have these issues and seeks to provide only viewing capabilities. Nothing more.
Install from the Visual Studio Marketplace or from the Open VSX Registry.
The current PDF.js viewer requires VS Code 1.95 or later.
Alternatively, search for "PDF Viewer" in the Extensions view (Ctrl+Shift+X / Cmd+Shift+X) inside VS Code.
Once installed, open any .pdf file in VS Code. The extension automatically registers as the default editor for PDF files and renders them using the built-in PDF.js viewer.
Start with a Discussion, not a pull request. A Mathematic maintainer will review the proposal. If we decide to implement it, a maintainer or one of our AI agents will open the pull request. When Mathematic implements a proposal, the implementation pull request will link to the Discussion and credit its original author. GitHub restricts pull request creation to Mathematic maintainers, repository collaborators with write, maintain, or admin access, and authorized maintenance agents.
See CONTRIBUTING.md for the full policy.
If you find this extension helpful, please consider supporting its development through GitHub Sponsors. Your support helps maintain and improve this extension.
- update
pdfjs_version.txtto target version and hash - from root folder of this repo run
tools/prepare_pdfjs.sh, this will download PDF.js in given version and try to apply patches from thepatchesfolder to it- if the patches apply cleanly the command terminates and you are done
- if the patches fail to apply, for every conflict a
*.rejfile will be generated in theassets/pdf.jsfolder, you need to resolve these manually and then delete the.rejfiles
To keep the current PDF.js version and add patches, run with the --update-patches flag. The script stops after applying the current patches so you can modify assets/pdf.js. When you finish, it creates a new patch from your changes.
After you prepared your patches you can run the same command again, the second time the patches should apply cleanly and the assets/pdf.js should have the updated content you created earlier.
The prepare_pdfjs.sh script does not create any commits in this repo, after you are happy with the patches you prepared be sure to commit everything manually.
This project is free and open-source work by a 501(c)(3) non-profit. If you find it useful, please consider donating.