How to convert PDF files to base64 and process as text xml to ECC

We have a requirement to process the PDF file in SAP PI to ECC Inbound proxy which accepts base64 xml text and converts to PDF and stores on the server ,also itreturns the path of the respective pdf file back to sap PI. So its required to convert pdf file to base64 encoding in SAP PI.