Primo commit: trasferimento del progetto PPEasy
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
require 'dompdf/autoload.inc.php';
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
|
||||
$options = new Options();
|
||||
|
||||
|
||||
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isRemoteEnabled', true); // Enable remote files to be fetched
|
||||
|
||||
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
|
||||
|
||||
// HTML content for the PDF
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; }
|
||||
.content { text-align: center; }
|
||||
.content img { width: 100%; max-width: 500px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>Sample PDF with Image</h1>
|
||||
<img src="http://localhost/cmccopiaoriginale/public/assets/images/ce.jpg" alt="Image">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
|
||||
|
||||
$dompdf->loadHtml($html);
|
||||
|
||||
|
||||
|
||||
// (Optional) Set up the paper size and orientation
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
|
||||
|
||||
|
||||
// Render the HTML as PDF
|
||||
$dompdf->render();
|
||||
|
||||
|
||||
|
||||
// Output the generated PDF to Browser
|
||||
$dompdf->stream("sample.pdf", array("Attachment" => false));
|
||||
Reference in New Issue
Block a user