47 $this->
footer =
"--footer-font-size {$size} --footer-{$position} \"{$text}\"";
57 $uri = $this->pdf->uri;
59 if ($this->pdf->useToken)
62 $uri =
"/action/auto_login/authenticate?token=$token";
68 if ($this->pdf->landscape)
70 $flags =
"-O landscape ";
73 $tmpName = sha1(
$url . now()) .
".pdf";
75 $footer = ($this->footer) ? $this->
footer :
"";
78 $cmd =
"{$exe} {$footer} {$flags}-q \"{$url}\" {$output}";
86 trace(implode(
"\n",
$out), 3);
89 if (!$this->pdf->output) unlink(
$output);
134 $this->
footer =
"--footer-font-size {$size} --footer-{$position} \"{$text}\"";
145 $uri = $this->pdf->uri;
146 $uri = appendToQueryString(
$uri,
"__pdfoutput=1");
147 if ($this->pdf->landscape)
149 $uri = appendToQueryString(
$uri,
"__pdflayout=landscape");
152 if ($this->pdf->useToken)
155 $uri =
"/action/auto_login/authenticate?token=$token";
158 $url =
"http".($this->pdf->ssl?
"s":
"").
"://".
$config[
"http_host"].
$uri;
160 $flags =
"--headless --disable-gpu --no-margins --virtual-time-budget=2000";
162 $tmpName = sha1(
$url . now()) .
".pdf";
165 $cmd =
"{$exe} {$flags} \"{$url}\" --print-to-pdf={$output}";
173 trace(implode(
"\n",
$out), 3);
176 if (!$this->pdf->output) unlink(
$output);
189 $uri = $this->pdf->uri;
190 $uri = appendToQueryString(
$uri,
"__pdfoutput=1");
191 if ($this->pdf->landscape)
193 $uri = appendToQueryString(
$uri,
"__pdflayout=landscape");
196 if ($this->pdf->useToken)
199 $uri =
"/action/auto_login/authenticate?token=$token";
202 $url =
"http".($this->pdf->ssl?
"s":
"").
"://".
$config[
"http_host"].
$uri;
206 $tmpName = sha1(
$url . now()) .
".png";
209 $cmd =
"{$exe} {$flags} \"{$url}\" {$output}";
217 trace(implode(
"\n",
$out), 3);
220 if (!$this->pdf->output) unlink(
$output);
227 if (!isset($_GET[
"__pdfoutput"]))
return $template;
228 $layout = ($_GET[
"__pdflayout"] ==
"landscape") ?
" @page { size: landscape; }" :
"";
229 $styles =
"<style type='text/css' media='print'>{$layout} @page {margin:0;} body { margin: 1.5cm }</style></head>";
231 $template = preg_replace(
"/<\\/head>/i",
$styles, $template);
281 $uri = $this->pdf->uri;
282 $uri = appendToQueryString(
$uri,
"__pdfoutput=1");
283 if ($this->pdf->landscape)
285 $uri = appendToQueryString(
$uri,
"__pdflayout=landscape");
288 if ($this->pdf->useToken)
291 $uri =
"/action/auto_login/authenticate?token=$token";
294 $urlparam =
"http".($this->pdf->ssl?
"s":
"").
"://".
$config[
"http_host"].
$uri;
300 if ($this->pdf->output)
302 file_put_contents($this->pdf->output,
$content);
320 $uri = $this->pdf->uri;
321 $uri = appendToQueryString(
$uri,
"__pdfoutput=1");
322 if ($this->pdf->landscape)
324 $uri = appendToQueryString(
$uri,
"__pdflayout=landscape");
327 if ($this->pdf->useToken)
330 $uri =
"/action/auto_login/authenticate?token=$token";
333 $urlparam =
"http".($this->pdf->ssl?
"s":
"").
"://".
$config[
"http_host"].
$uri;
339 if ($this->pdf->output)
341 file_put_contents($this->pdf->output,
$content);
349 if (!isset($_GET[
"__pdfoutput"]))
return $template;
350 $layout = ($_GET[
"__pdflayout"] ==
"landscape") ?
" @page { size: landscape; }" :
"";
351 $styles =
"<style type='text/css' media='print'>{$layout} @page {margin:0;} body { margin: 1.5cm }</style></head>";
353 $template = preg_replace(
"/<\\/head>/i",
$styles, $template);
379 $this->useToken = $useToken;
393 $this->convertor->coverPage(
$url);
404 $this->convertor->footer(
$text, $position,
$size);
409 return $this->convertor->generate();
434 $this->useToken = $useToken;
448 $this->convertor->coverPage(
$url);
459 $this->convertor->footer(
$text, $position,
$size);
464 return $this->convertor->screenshot();
static createOneTimeToken($url, $ip_addr=null)
footer($text, $position="center", $size=11)
coverPage($url)
Provides a separate URL to use as the cover page of the PDF.
preProcessTemplate($template)
preProcessTemplate($template)
footer($text, $position="center", $size=11)
coverPage($url)
Provides a separate URL to use as the cover page of the PDF.
FakoliException is the base exception class for all Fakoli errors.
static using()
Import the datamodels, views and manifest for the specified component(s).
PDF($uri, $ssl=false, $useToken=true, $output=null, $landscape=false)
Creates a new PDF object configured to generate a PDF from the supplied URI on the local web applicat...
footer($text, $position="center", $size=11)
coverPage($url)
Provides a separate URL to use as the cover page of the PDF.
static createConvertor($pdf)
static getTempDirectory()
__construct($uri, $ssl=false, $useToken=true, $output=null, $landscape=false)
Creates a new PDF object configured to generate a PDF from the supplied URI on the local web applicat...
coverPage($url)
Provides a separate URL to use as the cover page of the PDF.
footer($text, $position="center", $size=11)
static getValue($component, $name)
Retrieve the value of the specified Setting.
footer($text, $position="center", $size=11)
preProcessTemplate($template)
coverPage($url)
Provides a separate URL to use as the cover page of the PDF.
footer($text, $position="center", $size=11)
preprocessTemplate($template)
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content