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:

"data:application/pdf;base64,JVBERi0xL..."

Solution we used is based on:

https://academy.creatio.com/documents/technic-sdk/7-13/integration-third-party-sites-iframe

Do You have any suggestion ?

 

Regards,

Marcin Kott

Like 0

Like

1 comments

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

 

Ext.Ajax.request({

                        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