“jalur gambar di pdfmake” Kode Jawaban

jalur gambar di pdfmake

getBase64ImageFromURL(url) {
return new Promise((resolve, reject) => {
  var img = new Image();
  img.setAttribute("crossOrigin", "anonymous");

  img.onload = () => {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;

    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0);

    var dataURL = canvas.toDataURL("image/png");

    resolve(dataURL);
  };

  img.onerror = error => {
    reject(error);
  };

  img.src = url;
});}


async createPdf() {
var docDefinition = {
  content: [
    
    {
      image: await this.getBase64ImageFromURL(
        "../../assets/ribbonLogo1.png"
      )
    }

jalur gambar di pdfmake

getBase64ImageFromURL(url) {
return new Promise((resolve, reject) => {
  var img = new Image();
  img.setAttribute("crossOrigin", "anonymous");

  img.onload = () => {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;

    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0);

    var dataURL = canvas.toDataURL("image/png");

    resolve(dataURL);
  };

  img.onerror = error => {
    reject(error);
  };

  img.src = url;
});}


async createPdf() {
var docDefinition = {
  content: [
    
    {
      image: await this.getBase64ImageFromURL(
        "../../assets/ribbonLogo1.png"
      )
    }

Jawaban yang mirip dengan “jalur gambar di pdfmake”

Pertanyaan yang mirip dengan “jalur gambar di pdfmake”

Lebih banyak jawaban terkait untuk “jalur gambar di pdfmake” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya