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

164
Vistas
How to get document.documentElement.getBoundingClientRect().height in node js?

I was try to get the height from html. I render the html using ejs because I need to insert a data into the html and then the result from ejs was processing with jsdom library.

I was write <script> in my html/ejs file to get the document.documentElement.getBoundingClientRect().height. But the result is return 0. And when I try to run document.body its return HTMLBodyElement {}. I placed the <script> inside the <body>. I assume when the document.body was not return any value, then something mistake there.

here's my code :

await new Promise(function (resolve, reject) {
      ejs.renderFile(path.join(__basedir, '/views/', 'pdf.ejs'), {
        title: fileNameGenerate,
        ...
      }, (err, data) => {
      if (err) {
          console.error(err)
          reject(err);
          done(err)
        } else {
          const dom = new JSDOM(`${data}`, {runScripts: "dangerously"});

...

What's make the document.body not returning any value ? PLease ask me if this informatiions is still not enough to solve that problem

about 4 years ago · Juan Pablo Isaza
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