0

I was creating a pdf generator following guidelines from this website "https://www.wix.com/velo/forum/coding-with-velo/pdf-generator-api-npm-demo"

code screenshot

I copy every code from the guideline, but when I click the submit button, error of [data:application/pdf;base64,undefined] occur, and no record is saved at the pdf generator.

Check the link of the website here: website link

I believe it should be something wrong with the code below

//code start

    import { pdf } from 'backend/pdf.jsw';
    
    $w.onReady(function () {
        var base64;
    
        $w('#btnSubmit').onClick(() => {
            let name = $w('#inName').value;
            let detail = $w('#inDetail').value;
            pdf(name, detail).then( e => {
                base64 = e;
                base64 = 'data:application/pdf;base64,' + base64
                let msg = {
                    "conv": true,
                    "dataUrl": base64
                }
                $w('#html1').postMessage(msg);
            });
        });
    });

// Code end

I search through the internet and some mentioned open data URl directly function is not supported since 2020 (see website). I am new in programme or codes, it would be greatful if someone could provide me the adjusted code.

Sorry for the trouble

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
Jessica
  • 1
  • 1

0 Answers0