clarifying the title of this question:
It turns out that DomPDF has two buttons, download and print; when downloading the file appears as it shows in the preview, but when printing simply disappear some margins at the bottom of the pages and there is even text that is hidden. I did not imagine that it was different to print directly than to download. Any suggestions? Here I leave the code in case it is useful
$html = '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
@page { margin-top: ' . $top . ';'
. 'margin-right: ' . $right . ';'
. 'margin-bottom: ' . $bottom . ';'
. 'margin-left: ' . $left . ';}
body{font-size: 10px;color: black;font-family: arial;}
#header { position: fixed; top: -15mm; height: 20mm; text-align: center; }
#footer { position: fixed; right: 0px;left: 0px; bottom: -25mm; height:20mm; text-align: center;}
#contador:after { content: counter(page); }
#watermark { position: absolute;top: -75px;left: -55px;width: 120%;text-align: center;z-index: -1000;}
p {margin: 0px; }
</style>
</head>
<body>
' . $divMarcaAgua . '
' . $header . '
' . $footer . '
<div ' . $styleLetra . ' id="content">
' . $_CUERPO . '
</div>
</body>
</html>';
// Render the HTML as PDF
if (!empty($_REQUEST["pdfGuard"])) {
if ($_REQUEST["pdfGuard"] == "pdf") {
$pdf = new Dompdf\Dompdf();
$pdf->set_option('defaultFont', 'Helvetica');
$pdf->set_paper("folio", "portrait");
$pdf->loadHtml($html);
$pdf->render();
$dir = $_SERVER["DOCUMENT_ROOT"] . _BASE_PATH . "media/";
if (!file_exists($dir)) {
mkdir($dir, 0777);
}
$dir = $_SERVER["DOCUMENT_ROOT"] . _BASE_PATH . "media/pdf/";
if (!file_exists($dir)) {
mkdir($dir, 0777);
}
$pdfs = $pdf->output();
file_put_contents($dir . '/documento' . date('Y-m-d') . '.pdf', $pdfs);
} else if ($_REQUEST["pdfGuard"] == "html") {
echo $_CUERPO;
}
} else {
// Close and output PDF document
$pdf = new Dompdf\Dompdf();
$pdf->set_option('defaultFont', 'Helvetica');
$pdf->set_paper("folio", "portrait");
$pdf->loadHtml($html);
$pdf->render();
$f;
$l;
if (headers_sent($f, $l)) {
echo $f, '<br/>', $l, '<br/>';
die('now detect line');
}
$pdf->stream($contrato["nombre"] . " " . $NOMBRE_INMUEBLE . date("YmdHis") . ".pdf", array("Attachment" => 0));
}
PDT: Thank you very much.