Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
¿Cómo obtener document.documentElement.getBoundingClientRect().height en el nodo js?

Intenté obtener la altura de html. Renderizo el html usando ejs porque necesito insertar datos en el html y luego el resultado de ejs se procesó con la biblioteca jsdom .

Estaba escribiendo <script> en mi archivo html/ejs para obtener document.documentElement.getBoundingClientRect().height . Pero el resultado es 0. Y cuando intento ejecutar document.body devuelve HTMLBodyElement {} . Coloqué el <script> dentro del <body> . Supongo que cuando document.body no devolvió ningún valor, entonces hubo un error allí.

aquí está mi código:

 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"}); ...

¿Qué hace que document.body no devuelva ningún valor? Por favor, pregúnteme si esta información aún no es suficiente para resolver ese problema.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!