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

246
Views
¿Cómo obtener dataURL de Salesforce ContentVersion en LWC?

Estoy tratando de obtener dataURL de Salesforce ContentVerison usando canvas.toDataURL en el método LWC pero recibo el siguiente error de política CORS: " imagen de error "

Código html de LWC:

 <template> <div id="full-screen-image" class="full-screen-image"> <img data-id="prev-image" src="/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&amp;versionId=06821000001Gsm8AAC&amp;operationContext=CHATTER&amp;contentId=05T21000004x5ga" class="testImage"> <canvas id="myCanvas" class="slds-hide" data-id="prev-canvas" style="border:1px solid #d3d3d3;"></canvas> </div> </template>

codigo js

 handleRotateRight() { var image = this.template.querySelector('[data-id="prev-image"]'); var canvas = this.template.querySelector('[data-id="prev-canvas"]'); var context = canvas.getContext('2d'); let img = new Image(); img.crossOrigin = "anonymous"; img.src = image.src; img.onload = function() { canvas.width = img.width; canvas.height = img.height; context.translate(canvas.width / 2,canvas.height / 2); context.rotate(Math.PI/2); context.drawImage(img, -img.width / 2, -img.height / 2); //convert to png image as dataURL var dataURL = canvas.toDataURL("image/png"); console.log('dataURL-->', dataURL); //convert that as base64 encoding var convertedDataURI = dataURL.replace(/^data:image\/(png|jpg);base64,/, ""); console.log('convertedDataURI-->', convertedDataURI); } }
about 4 years ago · Juan Pablo Isaza
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!