Bigtext variable with PDF file in coded (Base 64) string

denpardenpar Member Posts: 80
edited 2015-01-20 in NAV Three Tier
Hi all,

I have a BigText variable with a data string (coded Base 64). I would like to decode the string to a PDF file.....

I think this is possible using Convert.FromBase64String, but I can't find how this can be done?
If your work becomes a passion...
www.pardaan.com

Comments

  • denpardenpar Member Posts: 80
    Solved it.... :D

    abpBigPDFText BigText
    abpAutConvertBase64 DotNet 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Convert
    abpAutBytes DotNet 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Array
    abpAutMemoryStream DotNet 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.MemoryStream
    abpOutStream OutStream
    abpRecTempBlob Record TempBlob
    abpAutBytes:=abpAutConvertBase64.FromBase64String(abpBigPDFText);
    abpAutMemoryStream:=abpAutMemoryStream.MemoryStream(abpAutBytes);
    abpRecTempBlob.Blob.CREATEOUTSTREAM(abpOutStream);
    abpAutMemoryStream.WriteTo(abpOutStream);
    abpRecTempBlob.Blob.EXPORT('c:\temp\test.pdf');
    
    If your work becomes a passion...
    www.pardaan.com
  • MarijnMarijn Member Posts: 69
    Blob.EXPORT and Blob.IMPORT are deprecated in NAV2009 and can no longer be used in NAV2013. I seriously believe you shouldn't write any code nowadays which won't run in NAV2013, unless you're working on even older versions. It would be better to call the std. NAV function for exporting a blobfield to a file, like the ones in codeunit 419 in NAV2013.
  • denpardenpar Member Posts: 80
    @Marijn

    I agree...

    But unfortunately some of our customers are still using NAV 2009 (mainly caused by the economic situation)!
    If your work becomes a passion...
    www.pardaan.com
Sign In or Register to comment.