Detect-It-Easy/db/Binary/format_doc.PDF.1.sg
2026-06-20 22:32:01 +02:00

20 lines
No EOL
481 B
JavaScript
Executable file

// Detect It Easy: detection rule file
// Author: horsicq <horsicq@gmail.com>
// https://en.wikipedia.org/wiki/PDF
meta("format", "PDF");
function detect() {
if (/^\%PDF-\d+\.\d+/.test(File.read_ansiString(0, 10))) {
sVersion = File.getString(5, 3);
bDetected = true;
var c = 0;
for (i = 8; i < 15; i++)
if (File.read_uint8(i) & 0x80) c++;
if (c) sOptions = "binary data";
}
return result();
}