public function read(string $file): string
    {
        $destFile = tempnam(sys_get_temp_dir(), 'pdf_to_text_');

        $command = sprintf(
            'pdftotext -layout %s %s',
            escapeshellarg(realpath($file)),
            escapeshellarg($destFile)
        );

        $return = 0;
        $output = system($command, $return);

        $content = file_get_contents($destFile);
        unlink($destFile);

        switch ($return) {
            case 0:
                return $content;

            default:
                throw new \Exception($command . PHP_EOL . $output, $return);
        }
    }