PDF Association logo

Discover pdfa.org

Key resources

Get involved

How do you find the right PDF technology vendor?
Use the Solution Agent to ask the entire PDF communuity!
The PDF Association celebrates its members’ public statements
of support
for ISO-standardized PDF technology.

Member Area

PDF Association VSCode extension logo.

Download the PDF Association’s VS Code plugin for PDF syntax today!

The PDF Association’s unique Visual Studio Code “pdf-cos-syntax” extension is now available for immediate download.
About the author: Peter Wyatt is the PDF Association’s CTO and an independent technology consultant with deep file format and parsing expertise. A developer and researcher working on PDF technologies for more than … Read more
Peter Wyatt


November 28, 2023

PDF Association news



The PDF Association's unique Visual Studio Code "pdf-cos-syntax" extension is now available for immediate download.

This extension extends the popular programming editor with detailed PDF syntax awareness and a rich feature set, designed to support both those learning PDF as a page description language as well as more experienced developers looking for ways to write targeted PDF test files.

Although PDF is technically not a pure text format, creating and experimenting with simple PDF files that are text-based is a great way to understand PDF - and adding this extension into the VSCode development environment now makes this even easier.

Screen shot of an outline view of a PDF's structure.
The extension supports displaying an outline view of a PDF's structure.

At a high level, the features of the PDF COS syntax support extension for VSCode include:

  • Color-coded syntax highlighting
  • An outline tree navigation view of the PDF file showing the physical file layout, including incremental updates
  • Basic file problem reporting and highlighting, to help identify invalid files
  • Support for folding (e.g., collapse/expand) blocks of syntax so you can focus on what’s important
  • Auto-completion of first-class key names defined in PDF 2.0
  • Bracket and paired symbol matching
  • Toggling comments on and off for selected lines  
  • Hover hints, to aid understanding 
  • "Go-to" functionality to facilitate locating all indirect references to an object, to locate an object from a cross-reference table entry, and to locate the cross-reference entry for an object
  • Snippets, for easy creation of new example PDF files or new objects
  • Various custom commands to make the creation of text-centric PDF files easy, such as the insertion of Image XObjects from local image files (JPEG, PNG, etc.) with the conversion of stream data to ASCII-85 or ASCII-Hex (the two text-based filters supported by PDF).

The extension's full set of features are documented on the VSCode extension page and in this GitHub repo.

What this extension will NOT do

This extension will not provide any rendered views of pages in the PDF, or an interactive PDF viewing experience.

Other VSCode extensions already provide this functionality, or an external PDF application can be used, however features and compliance may vary. Developers with appropriate PDF viewing and rendering technologies are encouraged to support PDF developers by providing their own VSCode extensions.

Installation

Click on the Extensions icon on the left panel in VSCode, and enter "pdf-cos-syntax". Then simply click the "Install" button. From this point forward, opening any PDF or FDF file will enable full access to the rich functionality provided by this extension.

Screen display of the installation of the pdf-cos-syntax extension in Visual Studio Code
Screen display of the installation of the pdf-cos-syntax extension in Visual Studio Code

If you are not familiar with Visual Studio Code, then grab the PDF cheat sheet of the Visual Studio Code key bindings for your platform. While you're at it, also grab a copy of the PDF Association's PDF cheat sheets to help you get started.

Just a taste... hover hints!

The following screenshots provide a sense of just some of how the extension's hover hints can improve developer awareness and understanding.

Object numbers when hovering over cross-reference entries:

Screen shot of hover hint showing object number and byte offset.

Object numbers and corresponding line numbers when hovering over endstream or endobj keywords:

Screen shot of hover hint showing line number and object number.

Binary bit-mask display when hovering over a bit mask key name:

Screen shot of hover hint showing a binary bitmask.

ASCII displayed when hovering over a hexadecimal string:

Screen shot of hover hint showing ASCII over a hexadecimal string.

Adobe, Apryse, Foxit logos.

There's more to come...

This release is only the beginning. Stay tuned for more results from the PDF Association’s multi-year project sponsored by Adobe, Apryse, and Foxit to develop new resources derived from - and enhancing - the PDF specification.

 


This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. HR001119C0079. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency (DARPA). Approved for public release.

WordPress Cookie Notice by Real Cookie Banner