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

159
Views
Problema en safari al capturar la imagen de html, incluido el lienzo de la firma

Estoy trabajando en un proyecto de reactjs y estoy tratando de capturar el HTML para crear imágenes, incluido el lienzo de la firma. Funciona en Firefox y Chrome, pero no en Safari. La imagen se genera con el lienzo vacío.

Reaccionar lienzo de firma

HTML a imagen

 this.setState({ formInput: document.getElementById("form-pdf") }) generateImage(data) { const input = this.state.formInput; let apiService = new ApiServices(); if (input) { await htmlToImage.toBlob(input) .then((blob) => { console.log(blob,'blob') let file = new File([blob], "image.png", { type: "image/png" }) if (data) { let body = new FormData(); apiService.http.post(this.getAPINames().Upload, body, { headers: { 'Accept': 'application/json', 'Content-Type': 'multipart/form-data', }, timeout: 100000, }).then(response => { console.log("Success") }).catch(failure => { hideLoader(); if (isDev) { console.log("on upload image error:", failure) } }); } }) .catch((error) => { if (isDev) { console.log(error) } }) } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Resolví este problema simplemente con una doble ejecución de la función html-to-image, por lo que en tu caso podría ser así:

 generateImage(data) { const input = this.state.formInput; let apiService = new ApiServices(); if (input) { await htmlToImage.toBlob(input) .then(function(){ await htmlToImage.toBlob(input) .then((blob) => { console.log(blob,'blob') let file = new File([blob], "image.png", { type: "image/png" }) if (data) { let body = new FormData(); apiService.http.post(this.getAPINames().Upload, body, { headers: { 'Accept': 'application/json', 'Content-Type': 'multipart/form-data', }, timeout: 100000, }).then(response => { console.log("Success") }).catch(failure => { hideLoader(); if (isDev) { console.log("on upload image error:", failure) } }); } }) .catch((error) => { if (isDev) { console.log(error) } }) }) } }
about 4 years ago · Juan Pablo Isaza Report
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!