Hello,
I want to display in an iframe a pdf with pdf.js.
Since the pdf to be displayed changes according to the name in a field of a linked table, I wanted to use the example shown on the site that uses the atob () function.
var pdfData = atob(‘JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVVHlwZSAvQ2F0YWxvZwog’ +
‘IC9QYWdlcyAyIDAgUgo + PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVVHlwZSAvUGFnZXMKICAv’ +
‘TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K’ +
‘Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg’ +
‘L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA +’ +
‘PgogIC9Db250ZW50cyA1IDAgUgo + PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u’ +
‘dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq’ +
‘Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU’ +
‘CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu’ + ‘ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g’ + ‘CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw’ + ‘MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v’ +
‘dCAxIDAgUgo + PgpzdGFydHhyZWYKNDkyCiUlRU9G’);
I would like to convert a pdf and store it on the fly in a $file variable and render it with
var pdfData = atob (’<? php echo $file;?>’);
can you help me