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

131
Views
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 answers
Answer question

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