Quantcast
Channel: Microsoft Dynamics NAV Forum - Recent Threads
Viewing all articles
Browse latest Browse all 18803

Convert PDF to Base64 using OutStream

$
0
0

Hi Experts, 

I have a requirement wherein I have to convert the saved PDF to Base64. I have written the following code but that doesn't seem to work and there are hardly any blogs regarding it.

Filename := 'C:\NAV\Service Invoices\PSI0000081.pdf';
MyFile.OPEN(Filename);
MyFile.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream,IStream);
Byte := MemoryStream.GetBuffer();
locOutFile.ADDTEXT(Convert.ToBase64String(Byte));
MESSAGE(FORMAT(locOutFile));
MyFile.CLOSE; 

Can anybody suggest me how than can be done or where did I go wrong? Your suggestions are welcomed. 

Thanks in advance. 


Viewing all articles
Browse latest Browse all 18803

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>