Sample code for 30+ languages & platforms
Xojo Plugin

Base64 Encode a File

_LANGUAGE_ to Base64 encode the contents of a file.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

// Get the contents of a file into a base64 encoded string:
Dim fac As New Chilkat.FileAccess
Dim strBase64 As String
strBase64 = fac.ReadBinaryToEncoded("c:/data/something.pdf","base64")
If (fac.LastMethodSuccess <> True) Then
    System.DebugLog(fac.LastErrorText)
    Return
End If

// Now write the string to a file:
success = fac.WriteEntireTextFile("c:/data/something_pdf_base64.txt",strBase64,"us-ascii",False)
If (success <> True) Then
    System.DebugLog(fac.LastErrorText)
    Return
End If

System.DebugLog("Success!")