Search Results:

Thursday, October 17, 2013

Convert a Base64 String into a PDF File

Recently I had the need to decode a Base64 string and make a PDF of it.  Usually I would've written a small utility app, but this time I rolled with powershell: 

function decodeBase64IntoPdf([string]$base64EncodedString)
{
    $bytes = [System.Convert]::FromBase64String($base64EncodedString)
    [IO.File]::WriteAllBytes("C:\Users\medmondson\Desktop\file.pdf", $bytes)
}

I'm impressed with how quickly I can knock out a script like this (yes they are .NET assemblies) without having to load a new VS solution. Of course a lot more could be done to this (file format via an argument for example) but I thought I'd share it raw as I know I'll need to use it again one day.

From Matt's Blog


2 comments:

  1. This helped me a lot. Life saving example.
    Thank you.

    ReplyDelete
  2. Manu'S Blog: Convert A Base64 String Into A Pdf File >>>>> Download Now

    >>>>> Download Full

    Manu'S Blog: Convert A Base64 String Into A Pdf File >>>>> Download LINK

    >>>>> Download Now

    Manu'S Blog: Convert A Base64 String Into A Pdf File >>>>> Download Full

    >>>>> Download LINK zL

    ReplyDelete