Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
DOMPDF - Get last y position of the pdf

Is it possible to get the y position of the last HTML element when rendering an HTML document to a PDF with Dompdf?

I need to insert an element after pdf rendering at the end of my document (fields for digital signature)...

EDIT : As described in DOMPDF Github https://github.com/dompdf/dompdf/issues/1424 , you need to create a callback for the event 'end_frame' :

$dompdf = new Dompdf();
$dompdf->setCallbacks(
  array(
    'myCallbacks' => array(
      'event' => 'end_frame', 'f' => function ($infos) {
        $frame = $infos["frame"];
        // elements positions
        $GLOBALS["array_coord"][] = $frame->get_padding_box();
        // last page number
        $counter_frame = $frame->lookup_counter_frame('page');
        $page_number = $counter_frame->counter_value('page');
      }
    )
  )
);

and then after the rendering :

$dompdf->render();
// get the last y position in the PDF
$ligne_sign = sizeof($GLOBALS["array_coord"]) - 2;
$y = $GLOBALS["array_coord"][$ligne_sign]["y"];
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda