Guide

Check a PDF before opening: JavaScript, actions and limits

Check an unexpected PDF’s source and known risk patterns first. ScanBeforeOpen searches readable PDF keywords locally. Even without a match, the file has not been cleared of malware.

Responsible operator: Tom Silas Helmke, operator of ScanBeforeOpen. Content revised: .

Open the matching checker

What a JavaScript match actually means

Names such as /JavaScript, /OpenAction, /Launch and /EmbeddedFiles can indicate scripts, startup actions or attachments. A raw match does not establish that an action is reachable or malicious.

The search does not interpret a complete PDF object graph. Compressed object streams, encryption, referenced objects or incremental changes can limit its conclusions. Inspection coverage therefore remains visible separately from the risk color.

What the raw data check of a PDF sees
PDF file (bytes)Objects, streams, xref, trailerRaw data searchlooks for /JavaScript, /OpenAction, /LaunchA hit is a patternno proof of executionNot resolvedcompressed and encrypted partsPreview with PDF.jscanvas, without scripts and links

The sequence in words

  1. A PDF is a sequence of objects with names such as /JavaScript, /OpenAction or /EmbeddedFiles. Many objects are stored compressed in streams.
  2. ScanBeforeOpen searches the raw bytes for readable keywords. Nothing is executed and no document is built.
  3. A hit only shows that the pattern occurs. It does not say whether the action is reachable or harmful. Even a comment in the file can match.
  4. Compressed or encrypted objects stay unreadable. Even without a hit the file is therefore not checked as safe.
  5. The preview draws at most ten pages with PDF.js onto a canvas. Scripts, links and attachments are not executed.

Hidden content and PDF metadata

Document IDs, multiple trailers, layer markers or invisible-text commands can produce signals. They also occur in legitimate documents. The scanner does not fully extract text, comments or metadata from every PDF variant.

An ordinary-looking page says little about embedded objects. A metadata marker alone does not establish tracking either. Confidential documents still require approval and review by the responsible specialists.

Inspect locally without opening the original

Save the PDF without automatic opening. Choose it in the PDF risk checker and read the recommendation and inspection coverage first. Then open the priority findings to compare patterns and raw diagnostics.

For encryption, errors or an uncertain source, keep the original closed and confirm through an independent channel. The scanner neither removes passwords nor executes PDF code.

What preview and page-image export provide

Preview renders available pages with PDF.js on canvas, without embedding the original as an active document. Native decoding remains a bounded browser operation, not a malware sandbox.

Native processing requires input no larger than 16 MiB, at most 4 million render pixels per page, 8 million overall and 8,192 pixels per edge. Preview shows at most ten pages and may stop earlier because of the pixel budget.

Complete export creates PNG page images in a ZIP only for up to twelve pages and within all render budgets. Otherwise the whole export is blocked. Text selection, links and interactivity are lost; visible confidential information and watermarks can remain.

Reproducible synthetic example

This PDF contains /JavaScript only in an inert comment, with no script action. It still triggers pdf.token.JavaScript. This demonstrates a possible raw-pattern false positive, not proof of executable code.

The findings come from an actual local scan of this test file. Download it and choose it in the scanner. No real personal data or malware.

Download test file: pattern-demo.pdf

Example inspection coverage: partial.

Practical checklist

  • Independently confirm the source and expected content
  • Read inspection coverage as well as the risk color
  • Do not equate a raw match with executed malicious code
  • Keep the original closed after errors or when its source is unknown
  • Check exported page count and visible private information

Clear limits

PDF inspection here means raw-pattern searching with limited conclusions. Encrypted and compressed structures may remain inaccessible. Neither green nor a page-image export establishes safety.

FAQ

Can ScanBeforeOpen check every PDF for viruses?

No. It searches bounded raw-data patterns and replaces neither antivirus nor complete structural or dynamic malware analysis.

Why does the harmless example PDF trigger a JavaScript finding?

The word /JavaScript appears in an inert comment. The raw search still matches it. This demonstrates a possible false positive.

Does export remove all hidden information?

Page images omit many original PDF objects. Visible content, image watermarks and conclusions drawn from the content can remain. Complete anonymization is not promised.

Related reading

Technical sources