Pop\Pdf\Object\Object::compress PHP Метод

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

Method to compress the PDF object.
public compress ( ) : void
Результат void
    public function compress()
    {
        if ($this->stream != '' && function_exists('gzcompress') && strpos($this->def, ' /Image') === false && strpos($this->def, '/FlateDecode') === false) {
            $this->compress = true;
            $this->stream = "\n" . gzcompress($this->stream, 9) . "\n";
            $this->isCompressed = true;
        }
    }

Usage Example

Пример #1
0
 public function testCompress()
 {
     $o = new Object("<<5 0 obj\nstream\nBlah Blah\nendstreamendobj\n>>");
     $o->compress();
     $this->assertContains('<</Length 16 /Filter /FlateDecode>>', (string) $o);
     $this->assertTrue($o->isCompressed());
 }