mirror of
https://github.com/Karaka-Management/Resources.git
synced 2026-01-11 21:38:39 +00:00
47 lines
878 B
PHP
Executable File
47 lines
878 B
PHP
Executable File
<?php
|
|
|
|
namespace Mpdf\Writer;
|
|
|
|
use Mpdf\Strict;
|
|
use Mpdf\Mpdf;
|
|
|
|
final class JavaScriptWriter
|
|
{
|
|
|
|
use Strict;
|
|
|
|
/**
|
|
* @var \Mpdf\Mpdf
|
|
*/
|
|
private $mpdf;
|
|
|
|
/**
|
|
* @var \Mpdf\Writer\BaseWriter
|
|
*/
|
|
private $writer;
|
|
|
|
public function __construct(Mpdf $mpdf, BaseWriter $writer)
|
|
{
|
|
$this->mpdf = $mpdf;
|
|
$this->writer = $writer;
|
|
}
|
|
|
|
public function writeJavascript() // _putjavascript
|
|
{
|
|
$this->writer->object();
|
|
$this->mpdf->n_js = $this->mpdf->n;
|
|
$this->writer->write('<<');
|
|
$this->writer->write('/Names [(EmbeddedJS) ' . (1 + $this->mpdf->n) . ' 0 R ]');
|
|
$this->writer->write('>>');
|
|
$this->writer->write('endobj');
|
|
|
|
$this->writer->object();
|
|
$this->writer->write('<<');
|
|
$this->writer->write('/S /JavaScript');
|
|
$this->writer->write('/JS ' . $this->writer->string($this->mpdf->js));
|
|
$this->writer->write('>>');
|
|
$this->writer->write('endobj');
|
|
}
|
|
|
|
}
|