Read PDFs in VS Code with a dark mode that keeps images in color

PDF Viewer & PDF Reader, a VS Code extension by Zovo

A PDF viewer and PDF reader for VS Code. Read specs and papers next to your code on dark or sepia pages that keep photos in their real colors, and highlight the parts you want to find again.

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.pdf-viewer-dark, version 0.2.8.

It reloads when the PDF changes on disk, after a LaTeX, Typst or report build, and keeps your page, zoom and scroll position. It does not take Ctrl+P (Cmd+P on macOS), so Quick Open works while a PDF is open. Its find, go-to-page and zoom keys apply only while the PDF tab is active.

A PDF open in VS Code with dark pages. Three passages are highlighted in yellow, green and blue, and the Highlights tab on the left lists them with their page numbers

Quick start

  1. Install the extension.
  2. Click any .pdf file in the Explorer. Press Ctrl+F (Cmd+F on macOS) to search, and click the moon button to switch dark pages on or off.
A click on the PDF in the Explorer opens it with dark pages. Typing Japan highlights the matches, Enter jumps to the next one, and the moon button switches the page to light and back

Recorded in the same window. The white arrow is drawn in to show where each click lands.

Run "Get Started with PDF Reader" from the Welcome page for a short tour.

Questions people ask

How do I open a PDF in VS Code?

Install PDF Reader and click any .pdf file in the Explorer. It opens in the editor area. If you have another PDF extension, right-click the file and pick "Open With..." to choose this one.

Does VS Code have a PDF dark mode?

VS Code has no PDF viewer of its own. PDF Reader adds one, and its pages follow your theme, so a dark theme gives you dark pages. Click the moon button or run "PDF: Toggle Dark Pages" to switch it for the open file, or set pdfViewer.darkMode to on or off.

Will dark mode ruin photos and charts?

Photos keep their colors. Most dark PDF modes invert the whole page, so a blue sky turns orange. PDF Reader inverts the page and then paints each raster image back in its original pixels. Charts drawn as vector lines get inverted like text, because to the PDF they're lines.

Can I search inside a PDF in VS Code?

Yes. Press Ctrl+F (Cmd+F on macOS). Every match is highlighted, the counter shows where you are, and Enter and Shift+Enter jump between matches. "Aa" turns on match case.

Does it reload when I rebuild a LaTeX PDF?

Yes. When the file changes on disk the viewer reloads it and stays on the same page. Each PDF also reopens at the page and zoom where you left it.

Can I annotate or fill PDF forms?

No. It's a viewer. It doesn't fill forms, add annotations or print, and it never runs JavaScript from the PDF.

Is it free and private?

It's free and MIT licensed. pdf.js is bundled inside the extension, so it works offline, makes no network calls and sends no telemetry.

Highlights you can take to your notes

Select text on a page. A small bar with 4 colors appears under the selection. Click a color, or press H for yellow.

Text selected on a light page, with the color bar under it showing yellow, green, blue and pink

The sidebar's Highlights tab lists every highlight of the file with its page. Click one to jump to it, or click × to remove it. Highlights are saved in VS Code on this computer, for each file, and come back when you open the PDF again. They are not written into the PDF.

"Copy as Markdown" (or "PDF: Copy Highlights as Markdown" in the Command Palette) copies a list like this:

Highlights in earthquakes-october-2026.pdf


Paste it into a `.md` file. In the Markdown preview each link opens the PDF at that page.

![The copied highlights pasted into a Markdown file, with the Markdown preview showing the quotes and their page links](https://raw.githubusercontent.com/theluckystrike/pdf-viewer-vscode/main/images/vscode-highlights-markdown.png)

Sepia pages

The paper button next to the moon switches the open PDF to warm sepia pages, which are softer on the eyes than white. Photos and images keep their colors, as in dark mode. Set pdfViewer.lightPages to sepia to use it for every PDF.

The report on sepia pages with the Highlights tab open. The earthquake map keeps its original colors

Dark mode that leaves images alone

Most dark PDF modes invert the whole page, so a photo of a blue sky turns orange. This viewer inverts the page, then paints the original pixels of each raster image back on top.

The same page in the light theme on the left and in dark mode on the right. The map image has the same colors on both sides.

By default the pages follow your VS Code theme. Dark and high contrast dark themes get dark pages, light themes get the page as printed. The moon button in the toolbar, or "PDF: Toggle Dark Pages" in the Command Palette, switches it for the open file. Set pdfViewer.darkMode to on or off to stop following the theme.

Charts drawn as vector lines are inverted like text, because to the PDF they are lines, not pictures. A chart embedded as an image keeps its colors.

Search, outline and pages

Type in "Find in PDF". Matches light up on every page as the search runs, and the counter shows "3 of 23". Press Enter for the next match and Shift+Enter for the previous one. "Aa" turns on match case.

The sidebar has two tabs. Outline shows the PDF's bookmarks as a tree, and a click jumps to the exact spot. Pages shows a thumbnail of each page, with the current one marked.

The sidebar stays closed until you open it, also for LaTeX PDFs with bookmarks. To change that, set pdfViewer.sidebar to open (open it for every PDF) or remember (keep it the way you left it in the last PDF).

Zoom and position

Pick Fit width, Fit page, or 50% to 400% from the toolbar. Ctrl plus the mouse wheel, Ctrl+= and Ctrl+- also zoom (Cmd on macOS). They zoom the PDF, not the VS Code window.

Each PDF reopens at the page and zoom where you left it. When the file changes on disk, for example after a LaTeX build, the viewer reloads it and stays on the same page, at the same zoom and scroll position. If the build is still writing the file, the last version stays on screen until the new one can be read.

Press Ctrl+G in a PDF, type a page number and press Enter.

Links in Markdown can open a PDF at a page, the same way they work in a browser. Write [paper](docs/paper.pdf#page=12) in a .md file, then click it in the Markdown preview. #nameddest=results opens a named destination of the PDF, and &zoom=150 sets the zoom.

You don't have to type the links. "PDF: Copy Link to This Page" copies a link to the page you are reading, ready to paste into your notes.

Keys

KeyAction
Ctrl+F / Cmd+FFind in PDF
Enter, Shift+Enter, F3Next or previous match
Esc in the search boxClear the search
← →Previous or next page
Home, EndFirst or last page
Ctrl+=, Ctrl+-Zoom in, zoom out
Ctrl+GGo to page
HHighlight the selected text in yellow

The viewer leaves other VS Code keys alone. Ctrl+P opens Quick Open and Ctrl+Shift+P opens the Command Palette, as in any other editor.

Settings

SettingDefaultWhat it does
pdfViewer.darkModeautoauto follows the theme, on always dark, off never dark
pdfViewer.keepImagesInDarkModetrueKeep raster images in their colors on dark and sepia pages
pdfViewer.lightPageswhitesepia shows light pages in warm paper colors
pdfViewer.defaultZoompage-widthZoom for a PDF you open for the first time
pdfViewer.rememberLastPagetrueReopen each PDF at the last page and zoom (up to 500 files)
pdfViewer.sidebarclosedclosed keeps the sidebar closed, open opens it for every PDF, remember keeps your last choice
pdfViewer.maxFileSizeMB200Ask before opening larger PDFs
pdfViewer.askForRatingtrueAsk for a Marketplace rating after 3 files opened without an error on 2 different days. "Later" asks one more time after 7 days, "No thanks" never again. It never asks after an error. Turn it off with false.

More screenshots

Dark pages, search and outlineLight theme
Dark mode. The text is light on a dark page, the earthquake map keeps its colors, two matches for Japan are highlighted, and the outline is open on the leftThe same report in a light VS Code theme, with the page shown as printed
Page thumbnails, darkOutline jump, light
The Pages tab with three thumbnails, page 2 selected at fit page zoom, and a bar chart in its original colorsA click on 2. Largest events in the outline opens page 2 at the table of the largest earthquakes

Real output, light and dark. The extension's own webview code and its bundled pdf.js render test/fixtures/earthquakes-october-2026.pdf, a 3 page report built from the real USGS earthquake catalog for October 2026. scripts/readme-shots has the scripts that build the PDF and capture the shots in headless Chrome.

Privacy and security

The extension reads the PDF with the VS Code file system API and hands the bytes to the viewer. It doesn't upload anything, and it has no telemetry. The viewer runs under a strict Content-Security-Policy that allows only the extension's own scripts. Titles, text and links from the PDF are always inserted as plain text. PDF JavaScript and forms scripting are not run.

A link inside a PDF opens in your browser only when you click it, and only for http, https and mailto links.

Known limits

Credits

PDF rendering by pdf.js from Mozilla (Apache-2.0), bundled in media/pdfjs. The extension itself is MIT licensed.

Rate this extension on the Marketplace if it helps you read PDFs. A rating helps other people find it.

Install PDF Viewer & PDF Reader

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.pdf-viewer-dark.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.pdf-viewer-dark, version 0.2.8.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.