mikehaertl\pdftk\Pdf::getData PHP Method

getData() public method

public getData ( boolean $utf8 = true ) : string | boolean
$utf8 boolean whether to dump the data UTF-8 encoded. Default is true.
return string | boolean meta data about the PDF or false on failure
    public function getData($utf8 = true)
    {
        $property = $utf8 ? '_data_utf8' : '_data';
        if ($this->{$property} === null) {
            $command = $this->getCommand();
            $command->setOperation($utf8 ? 'dump_data_utf8' : 'dump_data');
            if (!$command->execute()) {
                return false;
            } else {
                $this->{$property} = trim($command->getOutput());
            }
        }
        return $this->{$property};
    }

Usage Example

Exemplo n.º 1
0
 public function testCanGetData()
 {
     $document = $this->getDocument1();
     $pdf = new Pdf($document);
     $data = $pdf->getData();
     $this->assertInternalType('string', $data);
     $this->assertContains('NumberOfPages: 5', $data);
 }
All Usage Examples Of mikehaertl\pdftk\Pdf::getData