How to Base64 Encode or Base64 Decode a PDF File

Hi all,
I need to convert a PDF file to Base64 to send it in a Request Soap field. Once the service returns the result in the same way it must be converted from Base64 to PDF file. I am using the component "Insert Document as Base64 into Database" but I can not find examples of how to configure this component. I have tried several ways to build the statement "Sql Statement" but it always returns error: << An error occurred in executing an Activity Class. >>
Does anyone have any idea of a solution?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Adding to the above comment.

    You need to be a bit cautious while dealing with Base64 data, as this may impact your server performance.

    Let's take an example to understand this better.

    • Let's consider you are encoding a 100 MB file into Base64 format, once after encoding is done, your file will grow and will be more than it's actual size, let's say 110 MB
    • During Base64 conversion Appian holds the entire data into the Buffers, means this will not be treated as the Streaming (flow) of Data like Binary Streaming (where read & write operations gets performed simultaneously to balance the load & achieve better performance). Hence more amount of usage of Base64 conversion may slow down your server performance as well

    I would recommend, if there are any possibilities to deal with Binary Stream then you should prefer that otherwise you should consider using Base64 conversion wisely.

Reply
  • 0
    Certified Lead Developer

    Adding to the above comment.

    You need to be a bit cautious while dealing with Base64 data, as this may impact your server performance.

    Let's take an example to understand this better.

    • Let's consider you are encoding a 100 MB file into Base64 format, once after encoding is done, your file will grow and will be more than it's actual size, let's say 110 MB
    • During Base64 conversion Appian holds the entire data into the Buffers, means this will not be treated as the Streaming (flow) of Data like Binary Streaming (where read & write operations gets performed simultaneously to balance the load & achieve better performance). Hence more amount of usage of Base64 conversion may slow down your server performance as well

    I would recommend, if there are any possibilities to deal with Binary Stream then you should prefer that otherwise you should consider using Base64 conversion wisely.

Children
No Data