<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 'On'); //On or Off require_once 'WkHtmlToPdf.php'; $pdf = new WkHtmlToPdf(); // Set default page options for all following pages //$pdf->setPageOptions(array( // 'disable-smart-shrinking', // 'user-style-sheet' => 'pdf.css', //)); // Add a page. To override above page defaults, you could add // another $options array as second argument. $pdf->addPage('http://osnap.org/tools/my-action-plan-2/?userlogin=slaven'); //$pdf->addPage('/?page_id=1202&preview=true'); //$pdf->addPage('<html><head></head><body><h1>hi mike!</h1></body></html>'); $pdf->send();
/** * Set the global options from plugin into the WKHTMLTOPDF generator class. */ protected function preGenerate() { $this->generator->setOptions($this->options); }
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 'On'); //On or Off // Initialize WKHtmlToPdf require_once 'WkHtmlToPdf.php'; $pdf = new WkHtmlToPdf(); // Get userlogin from query string $userlogin = $_GET['userlogin']; // add page from URL $pdf->addPage('http://osnap.org/tools/my-action-plan-archive/?userlogin='******''); // Save the PDF $date = new DateTime(); $filename = $userlogin . '-AP-' . $date->format('y-m-d_hia') . '.pdf'; $pdf->saveAs('pdf-action-plans/' . $filename); // echo the name of the file echo "Done! Action Plan archive<br/><b>" . $filename . "</b><br/>has been created.<br/><br/>"; echo "You should now see it in your list of Existing Archives."; ?>
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 'On'); //On or Off // Initialize WKHtmlToPdf require_once 'WkHtmlToPdf.php'; $pdf = new WkHtmlToPdf(); // Get userlogin from query string $userlogin = $_GET['userlogin']; // add page from URL $pdf->addPage('http://osnap.org/tools/assessment-report-archive/?userlogin='******''); // Save the PDF $date = new DateTime(); $filename = $userlogin . '-AR-' . $date->format('y-m-d_hia') . '.pdf'; $pdf->saveAs('pdf-assessment-reports/' . $filename); // echo the name of the file echo "Done! Assessment Report archive<br/><b>" . $filename . "</b><br/>has been created.<br/><br/>"; echo "You should now see it in your list of Existing Archives.";