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

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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