protected function findStartXref()
    {
        $reader = $this->parser->getStreamReader();
        $reader->reset(-self::$trailerSearchLength, self::$trailerSearchLength);

        $buffer = $reader->getBuffer(false);
        $pos = \strrpos($buffer, 'startxref');
        $addOffset = 9;
        if ($pos === false) {
            // Some corrupted documents uses startref, instead of startxref
            $pos = \strrpos($buffer, 'startref');
            if ($pos === false) {
                throw new CrossReferenceException(
                    'Unable to find pointer to xref table',
                    CrossReferenceException::NO_STARTXREF_FOUND
                );
            }
            $addOffset = 8;
        }

        $reader->setOffset($pos + $addOffset);

        try {
            $value = $this->parser->readValue(null, PdfNumeric::class);
        } catch (PdfTypeException $e) {
            throw new CrossReferenceException(
                'Invalid data after startxref keyword.',
                CrossReferenceException::INVALID_DATA,
                $e
            );
        }

        return $value->value;
    }
protected function findStartXref()
    {
        $reader = $this->parser->getStreamReader();
        $reader->reset(-self::$trailerSearchLength, self::$trailerSearchLength);

        $buffer = $reader->getBuffer(false);
        $pos = \strrpos($buffer, 'startxref');
        $addOffset = 9;
        if ($pos === false) {
            // Some corrupted documents uses startref, instead of startxref
            $pos = \strrpos($buffer, 'startref');
            if ($pos === false) {
                throw new CrossReferenceException(
                    'Unable to find pointer to xref table',
                    CrossReferenceException::NO_STARTXREF_FOUND
                );
            }
            $addOffset = 8;
        }

        $reader->setOffset($pos + $addOffset);

        try {
            $value = $this->parser->readValue(null, PdfNumeric::class);
        } catch (PdfTypeException $e) {
            throw new CrossReferenceException(
                'Invalid data after startxref keyword.',
                CrossReferenceException::INVALID_DATA,
                $e
            );
        }

        return $value->value;
    }
protected function findStartXref ( ) { $ reader = $ this -> parser -> getStreamReader ( ) ; $ reader -> reset ( - self :: $ trailerSearchLength , self :: $ trailerSearchLength ) ; $ buffer = $ reader -> getBuffer ( false ) ; $ pos = \ strrpos ( $ buffer , 'startxref' ) ; $ addOffset = 9 ; if ( $ pos === false ) { // Some corrupted documents uses startref, instead of startxref $ pos = \ strrpos ( $ buffer , 'startref' ) ; if ( $ pos === false ) { throw new CrossReferenceException ( 'Unable to find pointer to xref table' , CrossReferenceException :: NO_STARTXREF_FOUND ) ; } $ addOffset = 8 ; } $ reader -> setOffset ( $ pos + $ addOffset ) ; try { $ value = $ this -> parser -> readValue ( null , PdfNumeric :: class ) ; } catch ( PdfTypeException $ e ) { throw new CrossReferenceException ( 'Invalid data after startxref keyword.' , CrossReferenceException :: INVALID_DATA , $ e ) ; } return $ value -> value ; }
Find the start position for the first cross-reference.

@return int The byte-offset position of the first cross-reference.
@throws CrossReferenceException
Find the start position for the first cross - reference .