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

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

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