Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda