Skip to content

Repository files navigation

PDF Word Count

PDF Word Count icon

VS Code Marketplace  ·  Open VSX Registry

An extension for Visual Studio Code and Open VSX-based editors (such as Cursor), which displays the word count of PDF documents in the status bar, along with more detailed statistics about a PDF (file size, page count, character count, etc.) in the status bar tooltip upon hover.

Status bar example

Word count of a PDF displayed in the status bar

Status bar tooltip example

PDF statistics displayed in the status bar tooltip upon hover

Feel free to report any bugs or feature requests as issues on GitHub. Pull requests are also welcome!

How it works

The extension uses pdf.js to pull positioned text items from each page of a PDF document, then converts these into a block of continuous text by inserting spaces where the horizontal gap between items is large relative to the font height, starting a new line when the vertical position changes or an item reports an end of line. Words split by a hyphen at a line break are rejoined, so they don't get counted as separate words. The word count is then calculated as the number of whitespace-separated tokens in the resulting text, excluding any tokens that are just made up of punctuation.

Known Issues

...

Release Notes

1.0.2

Adds retries for attempting word count again when it fails (for example, during LaTeX compilation).

1.0.1

Fixes an issue where the word count was still displayed in the status bar when a non-PDF tab was active.

1.0.0

First full release of pdf-word-count. Adds page count, file size, and words per page stats to the status bar tooltip, along with styling improvements and improved documentation.

Pre-Release 0.0.3

Add pdfjs bundling to avoid extension import issue, expand the test suite to improve the extension robustness.

Pre-Release 0.0.2

Add Open VSX deployment and update extension description and notes.

Pre-Release 0.0.1

Initial release of pdf-word-count, a lightweight extension that displays the word count of PDF documents in the status bar. Only deployed to the VS Code Marketplace in this initial pre-release.

About

Extension for VS Code and Open VSX to display the word count of PDF documents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages