automatic PDF detection