X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=webkitpdf.php;h=4c470b51e303e4f487026ab73dc2ef2ada23b8f6;hb=89d910fcce0013a558bf8ed705de7c988afbccf9;hp=f643f014ed96461d707c698a50bea063c3cfa963;hpb=326f4f676df857dfb8f7a2a33148ab4c22da8834;p=app.webkitpdf diff --git a/webkitpdf.php b/webkitpdf.php index f643f01..4c470b5 100644 --- a/webkitpdf.php +++ b/webkitpdf.php @@ -54,7 +54,9 @@ class WebkitPdf unlink($outpr); $out = $outpr .'.pdf'; - $cmd = "timeout 30s $xvfb --auto-servernum $webkitpdf " . + // can take 2-5 minutes... + + $cmd = "timeout 300s $xvfb --auto-servernum $webkitpdf " . " --url " . escapeshellarg($_REQUEST['url']) . ' ' . " --pdf " . $out . ' '; @@ -69,22 +71,14 @@ class WebkitPdf header("Expires: "); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $ts) . " GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); - header('Content-length: '. filesize($out)); - header('Content-Disposition: attachment; filename="' . htmlspecialchars($out). '"'); + //header('Content-length: '. filesize($out)); + header('Content-Disposition: attachment; filename="' . htmlspecialchars(basename($out)). '"'); ini_set('display_errors', 0); $fh = fopen($out, 'rb'); - //fpassthru($fh); - - // passthrough seems to have problems -- trying fread - while(!feof($fh)) - { - echo @fread($fh, 1024*8); - ob_flush(); - flush(); - } + fpassthru($fh); fclose($fh);