mikehaertl\wkhtmlto\Pdf::toString PHP Метод

toString() публичный Метод

Get the raw PDF contents (triggers PDF creation).
public toString ( ) : string | boolean
Результат string | boolean The PDF content as a string or `false` if the PDF wasn't created successfully.
    public function toString()
    {
        if (!$this->_isCreated && !$this->createPdf()) {
            return false;
        }
        return file_get_contents($this->_tmpPdfFile->getFileName());
    }

Usage Example

Пример #1
0
 public function testToString()
 {
     $outFile = $this->getOutFile();
     $binary = $this->getBinary();
     $pdf = new Pdf('<html><h1>Test</h1></html>');
     $pdf->binary = $binary;
     $this->assertTrue($pdf->saveAs($outFile));
     $this->assertFileExists($outFile);
     $this->assertEquals(file_get_contents($outFile), $pdf->toString());
     unlink($outFile);
 }