read(0, Marker::VERSION->length()) !== Marker::VERSION->value) { throw new ParseFailureException('Unexpected start of file format. is this a pdf?'); } $versionString = $stream->read(strlen(Marker::VERSION->value), Version::length()); $version = Version::tryFrom($versionString); if ($version === null) { throw new ParseFailureException(sprintf('Unsupported PDF version "%s"', $versionString)); } return $version; } }