convert pdf file to base64 string

mulesomuleso Member Posts: 5
I have a pdf file stored in the TEMPORARYPATH on dynamics nav 2017, how can i convert it to base 64 string ?

Answers

  • ftorneroftornero Member Posts: 524
    Hello @muleso

    This is the code
    base64txt := Convert.ToBase64String(IOFile.ReadAllBytes(File2Convert))
    

    Where the vars are:
    base64txt Text
    File2Convert Text
    Convert DotNet System.Convert.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    IOFile DotNet System.IO.File.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    

    And File2Convert is the path to the file that you want to convert to base64.

    Regards
Sign In or Register to comment.