/** * {@inheritdoc} */ public function read($filename) { $meta = new ValueBag(); try { $infos = $this->pdfFile->getInfo($filename); foreach ($infos as $key => $value) { $meta->set(strtolower("pdfinfo.{$key}"), new MetaValue($value)); } } catch (\Exception $e) { } return $meta; }
public function testGetInfo() { $pdfFile = new PdfFile(Pdfinfo::create($this->createLoggerMock()), $this->createPdftotextMock(), $this->createPdftohtmlMock()); $info = $pdfFile->getInfo(__DIR__ . '/../files/pdf-sample.pdf'); $this->assertNotEmpty($info); $this->assertInternalType('array', $info); $this->assertSame('This is a test PDF file', $info['Title']); $this->assertSame('1', $info['Pages']); $this->assertSame('1.3', $info['PDF version']); $this->assertSame('Thu Jun 29 10:21:08 2000', $info['CreationDate']); }
public function testGetInfo() { $pdfFile = new PdfFile($this->createPdfinfoMock(), $this->createPdftotextMock(), $this->createPdftohtmlMock()); $info = $pdfFile->getInfo(__DIR__ . '/../files/pdf-sample.pdf'); }