What's new in Customer Journeys?

Connect and learn more! ×
Base64 to pdf error: cannot download — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Base64 to pdf error: cannot download

Accepted answer
93
Views
11
Comments
edited Jun 24, 2023 11:08PM in Visual Builder 11 comments

Summary:

Hi experts

Content (required):

I am trying to download files from external database

and they are pdf. i used two different functions but non of them works. i tried two different cases. to use table and hyperlink. but non of them works too. latest download is text.


I am using a function1 :

download (blobData, contentType, fileName) {

    var element = document.createElement('a');

    element.setAttribute('href', this.preview(blobData, contentType));

    element.setAttribute('download', fileName);

    element.style.display = 'none';

    document.body.appendChild(element);

    element.click();

    document.body.removeChild(element);

  };


I also used this function2:


PageModule.prototype.download = function (data) {

    var bString = window.atob(data);

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!