0
HTMLкнопку печати для вывода генерируется DOMPDF
<p style="color:red;font-size: 30px;">sfsdfsdfdsfsdfdsfdsf</p>sdgfhgfhgfhg
PHP
<?php
// include autoloader
require_once 'dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
//to put same file html
/*$html1 =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';*/
// instantiate and use the dompdf class
$dompdf = new Dompdf();
//to put other html file
$html = file_get_contents('index.html');
$dompdf->loadHtml($html);
//$dompdf->loadHtml('<h1>Welcome to CodexWorld.com</h1>');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('Legal', 'Landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
//$dompdf->stream();
// Output the generated PDF (1 = download and 0 = preview)
$dompdf->stream("codex",array("Attachment"=>0));
//$output = $dompdf->output();
//file_put_contents("pdfs/file.pdf", $output);
?>
Я использую DOMPDF конвертировать мой HTML в PDF, что я хочу сделать здесь кнопка печати в index.html страницы, когда я нажимаю на эту кнопку печати, сгенерированный PDF-файл должен загружаться в систему пользователя.
Как я могу добиться того, что
Получение ошибки Parse: ошибка синтаксиса, непредвиденная ошибка 'use' (T_USE) – vamsi
Перемещение для использования Dompdf \ Dompdf; внешний isset работал, но могу ли я показать кнопку загрузки с учетом pdf? – vamsi
Я не знаю, что вы точно имеете в виду, но вы можете поместить кнопку загрузки везде, где хотите, и ссылаться на правильный скрипт с чем-то вроде 'Download PDF'. Им не обязательно быть в одном скрипте. – FamousWolluf