How to encode base64 in Delphi 6?

user1984193 picture user1984193 · Feb 18, 2013 · Viewed 11.8k times · Source

I need to encode a pdf document to base64 in Delphi6. Can anyone help me?

Answer

David Heffernan picture David Heffernan · Feb 18, 2013

You can use the EncdDecd unit that is supplied with Delphi. The function you need is EncodeStream. You simply need to create two streams, one for input and one for output. If you are working with files then you should create TFileStream instances.

Once you have your two file streams created, all you need is:

EncodeStream(InputStream, OutputStream);