Client module schema - get file from attachments as a base64

Hi Team,


I can't find any working example of js to get attachments related to entity and convert it to base64.

The case we are try to achive is display pdf on one of tab as a iframe. All code works when i put "pdf base64" directlly to the code but i would like to get this pdf from attachment ..

The content of the body looks as example:


Solution we used is based on:

Do You have any suggestion ?



Marcin Kott

Like 0



Please feel free to use the example how to get a pdf file in Creatio and convert it to base64 format:


                        url: getFileURL,
                        method: "GET",
                        autoAbort: false,
                        binary: true,
                        documenttype: "application/pdf",
                        headers: {
                            "Content-Type": "application/pdf"
                        success: function(result) {
                            var byteArray = result.responseBytes;
                            var len = byteArray.byteLength;
                            var pdfData = "";
                            for (var i = 0; i < len; i++) {
                                pdfData += String.fromCharCode(byteArray[i]);
                            pdfData = window.btoa(pdfData);
                        failure: function(error) {
                        scope: this

Show all comments