Quick start
- Install PostScript Preview from the Visual Studio Marketplace or Open VSX.
- Install Ghostscript and Poppler for your operating system.
- Open a
.ps or .eps file in Visual Studio Code.
- Select the preview icon in the editor title bar.
The Visual Studio Marketplace installs the companion PostScript Language extension automatically so Visual Studio Code can recognize PostScript files. Open VSX does not currently mirror that dependency; Open VSX and VSCodium users must first download its VSIX and run Extensions: Install from VSIX....
Highlights
|
|
Live preview View .ps and .eps output beside the source file. |
Multi-page navigation Move between pages or jump directly to a page. |
Pan and zoom Inspect SVG output with smooth navigation controls. |
Automatic refresh Regenerate the preview whenever the source file is saved. |
Theme-aware interface Match Visual Studio Code's light and dark themes. |
Custom background Choose a preview color for transparent artwork. |
Ghostscript output Read output from ==, print, and other operators. |
Configurable tools Use custom Ghostscript and Poppler executable paths. |
Requirements
PostScript Preview delegates document conversion to three command-line tools:
| Tool |
Provided by |
Purpose |
ps2pdf (gswin64c.exe on Windows) |
Ghostscript |
Converts PostScript or EPS to PDF. |
pdftocairo |
Poppler |
Converts a PDF page to SVG for the preview. |
pdfinfo |
Poppler |
Detects the number of pages in a document. |
macOS
Install both dependencies with Homebrew:
brew install ghostscript poppler
Ubuntu and Debian
sudo apt-get update
sudo apt-get install ghostscript poppler-utils -y
Windows
Install Ghostscript with Chocolatey from an Administrator terminal:
choco install ghostscript -y
Download the latest prebuilt Poppler archive from poppler-windows, then extract it to C:\Program Files\poppler. The Chocolatey poppler package does not currently include a complete set of working Windows binaries, so the release archive is the recommended source.
Add the installed tools to the system PATH (the command detects the installed Ghostscript version):
$gs = (Get-ChildItem "C:\Program Files\gs\gs*\bin\gswin64c.exe" | Select-Object -Last 1).Directory.Parent.FullName
$popplerBin = (Get-ChildItem "C:\Program Files\poppler" -Filter pdftocairo.exe -Recurse | Select-Object -First 1).DirectoryName
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";$gs\lib;$gs\bin;$popplerBin", [EnvironmentVariableTarget]::Machine)
Restart Visual Studio Code after installation.
If automatic PATH setup does not work, add these directories through System Properties → Environment Variables, replacing <version> with the installed Ghostscript version:
C:\Program Files\gs\gs<version>\lib
C:\Program Files\gs\gs<version>\bin
C:\Program Files\poppler\poppler-<version>\Library\bin
Configuration
Custom paths are useful for Conda environments and other non-standard installations. Open Visual Studio Code settings and search for PostScript Preview, or add the values directly to settings.json.
| Setting |
Description |
Default |
postscript-preview.path.ps2pdf |
Path to the ps2pdf executable. On Windows, the default safely invokes gswin64c.exe from PATH. |
ps2pdf |
postscript-preview.path.pdftocairo |
Path to the pdftocairo executable. |
pdftocairo |
postscript-preview.path.pdfinfo |
Path to the pdfinfo executable. |
pdfinfo |
{
"postscript-preview.path.ps2pdf": "/opt/ghostscript/bin/ps2pdf",
"postscript-preview.path.pdftocairo": "/opt/poppler/bin/pdftocairo",
"postscript-preview.path.pdfinfo": "/opt/poppler/bin/pdfinfo"
}
Using the preview
Multi-page documents
Navigation controls appear when a PostScript document contains multiple pages:
- Select ◀ or ▶ to move one page at a time.
- Enter a page number to jump directly to it.
- Save the source file to regenerate the document and return to page 1.
Console output
To inspect Ghostscript output:
- Open the Output panel with
Ctrl+Shift+U on Windows or Linux, or Cmd+Shift+U on macOS.
- Select PostScript-Preview from the channel list.
- Save or reopen the preview to run the converter.
Troubleshooting
| Problem |
What to check |
| The preview icon is missing. |
Confirm the file's language mode is PostScript, then make sure the PostScript Language extension is installed and enabled. |
| A converter cannot be found. |
Run ps2pdf, pdftocairo, and pdfinfo in a terminal, or configure their absolute paths. |
| A newly installed tool is not detected. |
Restart Visual Studio Code so it receives the updated PATH. |
If the problem continues, open an issue with your operating system, extension version, and the PostScript-Preview output.
Development
git clone https://github.com/ahnafnafee/PostScript-Preview.git
cd PostScript-Preview
corepack enable
yarn install
yarn compile
Press F5 in Visual Studio Code to open an Extension Development Host.
Tests
| Command |
Coverage |
yarn test:unit |
Fast tests for pure preview behavior. |
yarn test:integration |
Extension activation and behavior inside a real Visual Studio Code host. |
yarn test |
The complete unit and integration test suite. |
See the testing guide for prerequisites, sample documents, and manual checks.
Credits
License
PostScript Preview is available under the MIT License.
If PostScript Preview is useful to you, consider starring the repository or leaving a review on the Visual Studio Marketplace.