A powerful PDF viewer extension for Visual Studio Code with native rendering and page-to-image extraction capabilities designed for AI-assisted workflows.
Author: Tim Haintz
License: MIT
Table of Contents
The Problem: VS Code cannot natively display PDF files, and AI assistants like GitHub Copilot cannot read PDF content directly.
The Solution: PDF Toolkit provides:
- Native PDF Viewing - View PDFs directly in VS Code without leaving your editor
- AI-Ready Screenshots - Extract PDF pages as images that can be shared with GitHub Copilot Chat using
#file: references, enabling AI to "read" and analyze your PDF content
Use Case: Share PDFs with GitHub Copilot
- Open a PDF in VS Code
- Click 📷 Screenshot → All Pages to extract pages as images
- Click Add to Copilot Chat in the notification
- The images are automatically attached to Copilot Chat - the AI can now see and analyse your PDF content!
This is perfect for:
- 📚 Research papers and academic articles
- 📋 Technical documentation and specifications
- 📊 Reports with charts and diagrams
- 📝 Any PDF you want AI assistance with
Features
PDF Viewing
- Native PDF Rendering: View PDF files directly in VS Code using Mozilla PDF.js
- Full Image Support: All embedded images, graphics, and diagrams render correctly
- Scroll-based Viewing: Scroll through all pages continuously
- Text Selection: Select and copy text directly from PDFs
- Dark Mode: Toggle inverted colours for comfortable reading (🌙 button or
D key)
Navigation and Zoom
- Zoom Controls: Zoom in, zoom out, fit to width, and reset zoom
- Page Navigation: Jump to any page using toolbar or keyboard
- Page Rotation: Rotate pages 90° clockwise (
R) or counter-clockwise (Shift+R)
- Keyboard Shortcuts: Full keyboard support for efficient navigation
Search and Outline
- Search (Ctrl+F): Find text within PDF documents with real-time highlighting
- Match Navigation: Navigate between search matches with prev/next buttons or Enter key
- Match Counter: See current match position and total count (e.g., "3 of 17")
- Outline/TOC Panel: Toggle document outline sidebar to navigate via bookmarks (
O key)
- Screenshot Menu: Click the 📷 Screenshot button for quick access to all export options
- Current Page: Save the currently viewed page as a PNG/JPEG image
- All Pages: Export every page of a PDF as individual images
- Custom Wizard: Multi-step wizard to select specific pages, resolution (72-288 DPI), and format (PNG/JPEG)
- Extract Embedded Images: Extract embedded raster images (photos, bitmaps, pre-rendered figures) directly from PDFs at their native resolution
- Automatic Detection: Scans all pages for embedded image objects (JPEG, PNG, inline images) using PDF.js operator analysis
- Smart Naming: Filenames include image index, page number, and dimensions (e.g.,
image_001_page3_800x600.png)
- Copilot Integration: Add extracted images directly to GitHub Copilot Chat for AI analysis
- Duplicate Detection: Skips images that have already been extracted, with options to overwrite
Note: "Extract Images" finds embedded raster images (photos, bitmaps) stored inside the PDF. Charts and diagrams drawn as vector graphics (common from matplotlib, R/ggplot, Excel, LaTeX/TikZ) are not embedded images — use Screenshot to capture those pages instead.
Installation
From VS Code Marketplace (Recommended)
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search for "PDF Toolkit"
- Click Install
Or install directly via the command line:
Bash / macOS / Linux:
code --install-extension TimHaintz.pdf-toolkit
PowerShell:
code --install-extension TimHaintz.pdf-toolkit
Command Prompt (cmd):
code --install-extension TimHaintz.pdf-toolkit
From VSIX File
- Download the
.vsix file
- Open VS Code
- Press
Ctrl+Shift+P and type "Install from VSIX"
- Select the downloaded
.vsix file
Usage
Opening PDFs
Simply open any .pdf file in VS Code. The PDF Toolkit will automatically display it.
| Button |
Action |
| Prev / Next |
Navigate between pages |
| Page Input |
Jump to a specific page |
| - / + |
Zoom out / in |
| Fit Width |
Zoom to fit the page width |
| Reset |
Reset zoom to 100% |
| 📷 Screenshot ▾ |
Opens screenshot menu with options: |
| └ 📄 Current Page |
Extract current page as image |
| └ 📚 All Pages |
Extract all pages as images |
| └ ⚙️ Custom... |
Open multi-step wizard for custom extraction |
| └ 🖼️ Extract Images |
Extract embedded raster images (photos, bitmaps) |
| ↶ / ↷ |
Rotate pages counter-clockwise / clockwise |
| 🌙 |
Toggle dark mode |
| 🔍 Search |
Search text within the PDF (Ctrl+F) |
| 📑 Outline |
Toggle document outline/TOC sidebar |
| 📁 Extracted |
Browse previously extracted PDFs |
Keyboard Shortcuts
| Key |
Action |
| Left Arrow or Page Up |
Previous page |
| Right Arrow or Page Down |
Next page |
| Home |
First page |
| End |
Last page |
| + or = |
Zoom in |
| - |
Zoom out |
| R |
Rotate pages clockwise (90°) |
| Shift + R |
Rotate pages counter-clockwise (90°) |
| D |
Toggle dark mode |
| Ctrl + F |
Focus search input |
| O |
Toggle outline/TOC panel |
| Escape |
Clear search / Close outline |
Commands
Access via Command Palette (Ctrl+Shift+P):
PDF Toolkit: Open PDF - Open a PDF file using file picker
PDF Toolkit: Screenshot Menu - Open screenshot options menu
PDF Toolkit: Screenshot All Pages - Export all pages as images
PDF Toolkit: Screenshot Current Page - Export currently viewed page
PDF Toolkit: Screenshot Custom... - Open multi-step wizard for custom extraction
PDF Toolkit: Browse Extracted PDFs - View and manage previously extracted PDFs
PDF Toolkit: Zoom In - Increase zoom level
PDF Toolkit: Zoom Out - Decrease zoom level
PDF Toolkit: Reset Zoom - Reset to 100% zoom
Custom Screenshot Wizard
The Custom option in the screenshot menu opens a 3-step wizard:
- Select Pages: Enter page numbers or ranges (e.g.,
1,3,5-10) or type all
- Select Resolution: Choose from:
- Standard (72 DPI) - Smaller files
- High (144 DPI) - Balanced quality
- Very High (216 DPI) - Better quality
- Maximum (288 DPI) - Best quality
- Select Format: Choose PNG (lossless) or JPEG (smaller size)
When you extract pages, they are saved to a PDF-Screenshots/<pdf-name>/ folder in your workspace. Extracted embedded images are also saved to the same folder with descriptive filenames. The extension tracks your extractions so you can easily:
- Browse previously extracted PDFs via the 📁 Extracted button
- Copy image references for Copilot Chat with one click
- Manage your extraction history
Configuration
| Setting |
Default |
Description |
pdfToolkit.defaultZoom |
1.0 |
Default zoom level |
pdfToolkit.showToolbar |
true |
Show the PDF toolbar |
pdfToolkit.extractionQuality |
2.0 |
Quality scale (1.0=72dpi, 2.0=144dpi, 3.0=216dpi) |
pdfToolkit.extractionFormat |
png |
Image format (png or jpeg) |
pdfToolkit.screenshotsFolder |
PDF-Screenshots |
Folder name for storing extracted screenshots |
pdfToolkit.debug |
false |
Enable debug logging to the Output panel (PDF Toolkit Debug channel) |
Debug Logging
To enable debug logging:
- Open Settings (
Ctrl+,) and search for pdfToolkit.debug
- Check the box to enable it
- Reopen any PDF file (the setting is applied when a PDF is opened)
- Open View → Output and select PDF Toolkit Debug from the dropdown
Debug output includes search match details, text layer diagnostics, and other internal state useful for troubleshooting. Set pdfToolkit.debug to false (unchecked) to disable — there is zero overhead when disabled.
Changing the Screenshots Folder
You can change the folder name where screenshots are saved:
- Click 📁 Extracted button in the PDF viewer
- Select ⚙️ Change Folder Name...
- Enter your preferred folder name
- Click 🔄 Refresh to scan the new folder
Or change it directly in VS Code Settings: search for "PDF Toolkit Screenshots Folder".
Technical Details
This extension uses:
- PDF.js: Mozilla PDF rendering library
- VS Code Custom Editor API: For seamless editor integration
- Webview: For rendering PDF content
Requirements
Responsible Use
PDF Toolkit is a tool for viewing and extracting images from PDF files. Users are responsible for ensuring their use complies with applicable laws and policies.
✅ Generally Appropriate Use
- Your own documents and creations
- Public domain materials
- Documents you have explicit permission to copy
- Fair use purposes (research, education, commentary, criticism)
- Work documents you're authorized to access and share
- Copyrighted materials - Respect intellectual property rights
- Confidential documents - Follow NDA and confidentiality agreements
- Personal data - Be mindful of privacy regulations (GDPR, etc.)
- Corporate sensitive data - Follow your organisation's data handling policies
🤖 When Sharing with AI Services
When pasting extracted images into AI assistants like GitHub Copilot:
- Content may be processed by external servers
- Check your organisation's AI usage policies
- Avoid sharing confidential, proprietary, or personal data
- Review your AI service's data handling and privacy policies
Disclaimer: This tool does not bypass any PDF security or DRM protections. Users are solely responsible for ensuring their use of extracted content complies with copyright laws, licensing agreements, and organizational policies.
Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Please ensure your code follows the existing style and includes appropriate tests.
Issues & Feature Requests
Found a bug or have an idea for a new feature?
License
MIT License - see LICENSE for details.
Author
Tim Haintz