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

RESOURCE

VSCode extension: PDF COS Syntax Support

PDF Association VSCode extension logo.This extension extends the popular Visual Studio programming editor with PDF syntax awareness, and is designed to support those learning PDF as a page description language.

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

Screen shot of 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.

There’s more (to come)…

Adobe, Apryse, Foxit logos.

This Extension 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.

RESOURCE INFO

Get the Extension


INFO

PDF and FDF COS syntax VSCode extension for PDF developers interested in learning PDF as a page description language syntax.

Comments are welcome! Please email info@pdfa.org with your suggestion(s).

Published by the PDF Association © 2023

November 29, 2023

WordPress Cookie Notice by Real Cookie Banner