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

190
Views
¿Cómo obtener los datos HTML excepto Viewport?

Aquí mencioné un código de muestra. Estoy convirtiendo div a imagen usando la biblioteca dom-to-image. Estoy tratando de obtener los datos completos de un elemento HTML div sin cambiar su posición. Pierdo datos de la izquierda y la parte superior del elemento. ¿Cuál es la mejor manera de obtener todos los datos del elemento sin cambiar la posición o sugerir una biblioteca para resolver este problema?

 <!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js"></script> <title>Page Title</title> <style> #canvas { height: 200px; width: 200px; border: 1px solid; position: absolute; top: -100px; left: -100px } </style> </head> <body> <div id="canvas"> <div>This is for testing purpose</div> </div> <script> var canvasId = document.getElementById('canvas'); domtoimage.toJpeg(canvasId, { bgcolor: 'white' }).then(res => { var link = document.createElement('a'); link.download = 'sample.jpeg'; link.href = res; link.click(); }) </script> </body> </html>
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!