// Detect It Easy: detection rule file format

init("format", "PDF");

function detect(bShowType, bShowVersion, bShowOptions) {
    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 = "with binary data"
    }

    return result(bShowType, bShowVersion, bShowOptions);
}