Added the case to detect PDF format from file signature

This commit is contained in:
DreamPiggy 2020-01-30 14:04:12 +08:00
parent 8ca4556066
commit 08aab785db
1 changed files with 9 additions and 0 deletions

View File

@ -65,6 +65,15 @@
}
break;
}
case 0x25: {
if (data.length >= 4) {
//%PDF
NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(1, 4)] encoding:NSASCIIStringEncoding];
if ([testString isEqualToString:@"PDF"]) {
return SDImageFormatPDF;
}
}
}
}
return SDImageFormatUndefined;
}