How to render the transaction as PDF and get the PDF as Base64 encode format

 let transactionFile = render.transaction({

                        entityId: parseInt(internal id of the transaction)

                        printMode: render.PrintMode.PDF,

                       

                    });

                    log.debug(“pdf”, transactionFile)

                    transactionFile.folder = internal id of the folder where you want to save the pdf file;

                    let fileId = transactionFile.save();

                    log.debug(“fiel id”, fileId)

                    let pdfFile = file.load({

                        id: parseInt(fileId)

                    });

                    let fileContents = pdfFile.getContents();

                    log.debug(“file contents”, fileContents)

the getContents() returns the pdf as base64 format, which is useful to integration purpose.

Leave a comment

Your email address will not be published. Required fields are marked *