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

168
Vistas
Issue on safari while capturing image of html including signature canvas

I am working on a reactjs project and I am trying to capture the HTML for creating images including the canvas of signature. It's working on firefox and chrome but not safari. Image is generated with the empty canvas.

React Signature Canvas

Html To Image

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 Respuestas
Responde la pregunta

0

I've resolved this problem just with a double execution of the html-to-image function, so in your case it could be like this:

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 Denunciar
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