How to convert Encode64 to pdf file using Notepad++?

  • How to convert Encode64 to pdf file using Notepad++?

  • @Chokka

    What do you mean with “Encode64”?

  • @Chokka

    Answer: You don’t.

  • Hello, @Chokka

    Please try this code, To convert Encode64 to PDF file using notepad++ :

    // The Base64 string of a simple PDF file
    var b64 = 'qWbOvwrMwEm+qrA30N6zFIMdzO/mW5zRN44s26ZLnQdSAs8CmVuZHN0cmVhbQplbmRvYmoKc3RhcnR4cmVmCjE5NzExCiUlRU9GCg==';
    // Decode Base64 to binary and show some information about the PDF file (note that I skipped all checks)
    var bin = atob(b64);
    console.log('File Size:', Math.round(bin.length / 1024), 'KB');
    console.log('PDF Version:', bin.match(/^.PDF-([0-9.]+)/)[1]);
    console.log('Create Date:', bin.match(/<xmp:CreateDate>(.+?)<\/xmp:CreateDate>/)[1]);
    console.log('Modify Date:', bin.match(/<xmp:ModifyDate>(.+?)<\/xmp:ModifyDate>/)[1]);
    console.log('Creator Tool:', bin.match(/<xmp:CreatorTool>(.+?)<\/xmp:CreatorTool>/)[1]);
    // Embed the PDF into the HTML page and show it to the user
    var obj = document.createElement('object'); = '100%'; = '842pt';
    obj.type = 'application/pdf'; = 'data:application/pdf;base64,' + b64;
    // Insert a link that allows the user to download the PDF file
    var link = document.createElement('a');
    link.innerHTML = 'Download PDF file'; = 'file.pdf';
    link.href = 'data:application/octet-stream;base64,' + b64;

    I hope above code will be useful for you.
    Thank you.

Log in to reply