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

132
Visualizações
Black Images when transforming HTML to Jpeg

I need to add a feature on my app that allows users to save, as an image, in their Photo Documents on the device, a portion of the App.

I'm using Nuxt.js and the content is just inside a Dialog, simple like this:

<v-card ref="print" outlined class="certificate">
  <v-img :src="photo.url"></v-img>
  <v-card-text>
    {{ photo.title }}
  </v-card-text>
</v-card>

The image src is on external storage, not in my assets, ofc...

The code to generate the file to be saved is the following:

      const el = this.$refs.print
      const options = {
        type: 'dataURL',
        useCors: true,
        scale: 2,
        logging: false,
      }
      try {
        const canvas = await this.$html2canvas(el, options)
        await Filesystem.writeFile({
          path: `certificate-${this.photo.id}.jpeg`,
          data: canvas,
          directory: Directory.Documents,
        })
      } catch (error) {
        // ...
      }

It works, it gets the right portion of HTML and saves a Jpeg to my Documents, unfortunately, the images within are always total black...

Why??? How can I fix this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You do not provide any encoding options to Filesystem.writeFile() and is therefore saved as base64 encoded per default. The HTML canvas-element is not base64 encoded.

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