We convert Blob to Base64 encoded string. Convert A File To A Base64 String Or DataURL Using JavaScript January 18th, 2021 Converting JavaScript file objects or blobs to Base64 strings can be useful. is there any alternate way to encode such files to byte array Base64.???? Used the Accepted Answer to do a check for IE and convert the dataURI to UInt8Array; an accepted form by PDFJS. Do EMC test houses typically accept copper foil in EUT? With extension KIO4_Base64 convert string Base64 to file pdf. Why does the impeller of a torque converter sit behind the turbine? If you have the file data as a base64 string, the best way to load the document in WebViewer is to first convert it to a Blob and then load it as described for Blobs . Truce of the burning tree -- how realistic? Was Galileo expecting to see so many stars? Nice work. All files are processed on our servers. Convert content to PDF with jsPDF library. WebOpening a document in WebViewer from base64 data. By the way, I do not know any details about your app, but if possible, instead of a blank PDF consider to embed first page of your real PDF file. This helps with a lot of issues. Hi! You're welcome, Mnica. Can you share a snippet you used to save it locally? Getting the logged base64 and pasting it on these online base64 decoder we get a BLANK PDF. The next step is to convert this PDF binary to base64 encoded string. Download Guitar Flash Mod Apk Terbaru Android; CSR Racing 2 APK Data Mod v1.13.2 (Lots of Money) Terbaru I need help to take a hl7 oru that contains the obx Base64 message. Find centralized, trusted content and collaborate around the technologies you use most. Does Cast a Spell make you a spellcaster? Webfunction convertToBase64 () { //Read File var selectedFile = document.getElementById ("inputFile").files; //Check File is not Empty if (selectedFile.length > 0) { // Select the very first file from list var fileToLoad = selectedFile [0]; // FileReader function for read the file. No need to more libs . Hi,i tried with my base64 data.but while converting it to pdf tool gives empty pdf.i wrote code for the same but it gives a blank pdf.can you help me with this?? In this tutorial well explore how to use JavaScript to generate a Base64 string and a DataURL from a file object. So for that, we need to either use Promises to return the result as soon as the function resolves or we can use callback function which will trigger when any response occurs from this readAsDataURL() function. Choose the source of PDF file from the Datatype field. Not the answer you're looking for? Not the answer you're looking for? Regards, Bretty Message 7 of 8 4,654 Views 0 Reply Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Hello, It's not working for me, here is my data format, "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2.". NodeJS has a built-in class called Buffer. Just select your file or drag & drop it below, press the Convert to Base64 button, and you'll get a base64 string. If you have logs this was all between 7-7:40am Eastern on 04/20/2020. Would the reflected sun's radiation melt ice in LEO? WebHow to convert Base64 to PDF Paste your string in the Base64 field. Thanks for the explanation. on Convert PDF file to Base64 Encoding in React, Click to share on Facebook (Opens in new window), Click to share on Twitter (Opens in new window), Click to share on WhatsApp (Opens in new window), Click to share on LinkedIn (Opens in new window), Click to share on Reddit (Opens in new window), Click to share on Telegram (Opens in new window), Click to email a link to a friend (Opens in new window), useLayoutEffect Hook in React: A Practical Guide with Examples, 6 Different ways to Check React Version | Terminal, How to combine multiple reducers in React Hooks | useReducer, Forms in React JS Example | Login | SignUp Form, UNSAFE_componentWillReceiveProps in React Hook Functional, Functional vs Class Component in React Example, 3 different ways to encode and decode string to base64 format, Learn Elasticsearch Aggregations with Real-World Examples and Complex Calculations, Shallow Routing in Next.js using next/Link, Shallow Routing in Next.js with Router Push Method, How to Optimize Elasticsearch Mapping with Flattened Types. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. The PDF to Base64 converter generates ready-made examples, depending on the selected output format. Find centralized, trusted content and collaborate around the technologies you use most. jsPDF for instance has a addImage() method (https://rawgit.com/MrRio/jsPDF/master/docs/module-addImage.html) which accepts a base64 string as input. Why does the impeller of a torque converter sit behind the turbine? By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Now, we have created our fileToBase64() function, now lets create and connect our UI with it. Is it possible to specify the default page to show? I have not encountered such tasks, but at first glance it seems to be a nice solution. It displays my pdf correctly. @Paulie78 @Johnnyg Message 4 of 4 3,038 Views 0 Reply 542), How Intuit democratizes AI development across teams through reusability, We've added a "Necessary cookies only" option to the cookie consent popup. PDF to Base64 Converter is your multipurpose conversion tool for almost all popular file formats. How to check whether a string contains a substring in JavaScript? Its an Angular app where I use the blank page as temporary page while the PDF loads from the server. If you forget to do this, they will be automatically deleted from our server after 24 hours. A data url has the form data: [
] [;base64],. MIME types: application/pdf, application/x-pdf, application/x-bzpdf, application/x-gzpdf. The Problem with this is that XMLHttpRequests do not support data: uris (eg. Below is some example code showing how to convert base64 to a Blob. Therefore, if you are not sure that your Base64 string is a PDF, use the Base64 to file converter since it is capable of displaying various file types. There was a bug on that page due to which the browser was getting invalid data. One can also alter the program and specify the path or URL and do some alterations in the above function to convert the file to base64 format. You can convert files to PDF to Base64 from any OS or device with an internet connection. You can also convert PDF into many other file formats. How can I convert a string to boolean in JavaScript? This webpage utility does not complete successfully when i try. Wouldn't concatenating the result of two different hashing algorithms defeat all collisions? as in example? Immediately after converting it to base 64 I try to store it on my computer as pdf but it says "We cannot open this file" :(. Convert Base64 to PDF online using a free decoding tool which allows you to decode Base64 as PDF and display it directly in the browser. I recommend you to try the. Ackermann Function without Recursion or Stack. How do I return the response from an asynchronous call? I have a link to a local pdf file and I need that file as a base64 string. When expanded it provides a list of search options that will switch the search inputs to match the current selection. Open free Base64 website and choose Convert application. If you have any questions, remarks, need help, or just like this page, please feel free to let me know by leaving a comment using the form bellow.I will be happy to read every comment and, if necessary, I will do my best to respond as quickly as possible. Yup, I can preview and download that doc but when I try to open the downloaded pdf it appears to be corrupt. It automatically detects the content type of the uploaded PDF file, so that you simply copy the complete result. Make sure to check out FilePond a free file upload component, and Pintura an image editor that works on every device. // Listen for the change event so we can capture the file, // Encode the file using the FileReader API. How can the mass of an unstable composite particle become complex? Asking for help, clarification, or responding to other answers. Launching the CI/CD and R Collectives and community editing features for How can I validate an email address in JavaScript? NodeJS has a built-in class called Buffer. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. rev2023.3.1.43269. Let's simulate the following scenario: your API services need to request a PDF file to another external API service using a secret api key. Before writing this function, lets create 2 states in a project where one state will hold the file name and the other state holds the base64 formatted data of the particular file. Press a button get base64. I tried on another tool and had problems as well. What's the difference between a power rail and a signal line? Do EMC test houses typically accept copper foil in EUT? How to derive the state of a qubit after a partial measurement? I click download and it does nothing. In the last tutorial, we have already discussed 3 different ways to encode and decode string to base64 format in Node.js. do you know ?how to save file from encode code convert to decode pdf file and save file using php? Works great. Method 2: Image file to Base64 via JavaScript. I must use asp classic, but te decoding interrupted after few line.. But how to add the file object to the src attribute? If necessary, select the desired output format. It's helpful. Of course! How to react to a students panic attack in an oral exam? For my promlem it was ISO_8859_1, new RequestSpecBuilder().setConfig(config().decoderConfig(new DecoderConfig().defaultContentCharset(StandardCharsets.ISO_8859_1)). Once you have rendered the PDF in your appliaction using PDF.JS, converting a PDF page to an image is nothing special. WebOur PDF to Base64 conversion tool is easy to use: select the desired file type, then define the output format of your document, upload the file and click 'Upload'. This is so that the app doesnt error out when waiting for the real content to load. Ask Question. Helped me great for my testing purpose. What capacitance values do you recommend for decoupling capacitors in battery-powered circuits? How can I convert a string to boolean in JavaScript? Because of that, your services have to handle the request by themselves and respond the same PDF file retrieved from external services to your clients. The PDF is represents is a 26 page document with many Photos. How to store objects in HTML5 localStorage/sessionStorage. rev2023.3.1.43269. enter image description here. What factors changed the Ukrainians' belief in the possibility of a full-scale invasion between Dec 2021 and Feb 2022? Now, I want convert all of images to one pdf and attach it to a file upload. First, we need to create the React Application using the default starter pack provided by the React team. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Lihat Typescript Convert String To Base64. By using this site, you agree to our, javascript create pdf file from base64 string, convert pdf file to base64 javascript and back to pdf, how to convert pdf to base64 string node js, how to convert pdf in base64 encoded string js, js encode pdf string from server to base64, turn my pdf base64 encoded string javascript, convert pdf to base 64 and send download node js, how to convert pdf url to base64 in javascript, how to convert pdf to base64 string in node, convert entire pdf into base64 javascript, how to convert pdf to base64 in javascript, convert select pdf file to base64 javascript, javascript download pdf from base64 string, base64 to pdf in javascript and save file, base64 encode to pdf base64_encode in javascript, convert base64 encoding to pdf base64 in javascript plugin, convert base64 encoding to pdf base64 in javascript, how to convert pdf with its url to base64 in javascript, how to display base64 encoded pdf in javascript. How do you get out of a corner when plotting yourself into a corner, Ackermann Function without Recursion or Stack, Strange behavior of tikz-cd with remember picture. What is the purpose of this D-shaped ring at the base of the tongue on my hiking boots? In addition, you will receive some basic information about this PDF (MIME type, extension, size). Thanks for contributing an answer to Stack Overflow! What does. my content has \/ instead / not working? Now, go inside the App.js file and create a new function named fileToBase64(), which accepts 2 parameters: the first is the file we are going to upload and the second is the callback function will be triggered when we got the results that are encoded base64 string. Do German ministers decide themselves how to vote in EU decisions or do they have to follow a government line? 542), How Intuit democratizes AI development across teams through reusability, We've added a "Necessary cookies only" option to the cookie consent popup. I have a link to a local pdf file and I need that file as a base64 string. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. If you have any questions, remarks, need help, or just like this page, please feel free to let me know by leaving a comment using the form bellow.I will be happy to read every comment and, if necessary, I will do my best to respond as quickly as possible. It works great! Launching the CI/CD and R Collectives and community editing features for Pdf.js and viewer.js. You can upload maximum 10 files for the operation. Convert An Image To A DataURL or Base64 String Using JavaScript, The Trouble With Editing And Uploading Files In The Browser, Rename A File With JavaScript In The Browser. Thanks for contributing an answer to Stack Overflow! I tried encode and decode PDF. We can use such urls everywhere, on par with regular rev2023.3.1.43269. Please use the below code to convert Base64 to PDF with the client side JavaScript. Sometimes we just want to use an File object as an image source. At the moment I don't know what's wrong, but I suppose it may be because of a corrupted PDF file. WebGenerate a pdf to base64. I also tried this on another website and i get the 502 Bad Gateway error. data:application/pdf;base64,JVBERi0xLjUK). 0. Level up your programming skills with IQCode. No plugin or software installation required for you. That will be very helpful for me. Help please. Asking for help, clarification, or responding to other answers. How do I include a JavaScript file in another JavaScript file? Are there conventions to indicate a new item in a list? No one has access to your documents. Making statements based on opinion; back them up with references or personal experience. I'm programming with JavaScript. The next step is to convert this PDF binary to base64 encoded string. This key cannot be passed to your API clients. There are many times you need request a PDF file (or any other file) to external servers and then save it, or forward it to a client of your services. You can refer the Viorel sloution: read the contents of the file into a byte array and then use the Convert.ToBase64String () method to get the Base64 string. To convert one file type to another, you can use this app's feature for free. Sign up to unlock all of IQCode features: This website uses cookies to make IQCode work for you. Convert PDF file into Base64 string with JavaScript, Convert PDF to a Base64-encoded string in Javascript, The open-source game engine youve been waiting for: Godot (Ep. Converting file to base64 on Javascript client side | by Simmi Badhan | Medium 500 Apologies, but something went wrong on our end. very handy and works like a charm :). With our application, you only upload the edited file and nothing else. It starts like this: I hope you enjoy this discussion. It works from all platforms including Windows, Mac, Android and iOS. function downloadPDF (pdf) { const linkSource = `data:application/pdf;base64,$ {pdf}`; const downloadLink = document.createElement ("a"); const fileName = "abc.pdf"; downloadLink.href = linkSource; downloadLink.download = fileName; downloadLink.click ();} We need to make sure to revoke the URL if we no longer need the file. The snippet below creates a base64 string, its identical to the previous example but it uses a regular expression to remove the Data URL part. I'm programming with JavaScript. Is it possible to convert base64 pdf type string to text file?????? I posted a question on it here: I have tested it using the nodejs package with, Pdf.js: rendering a pdf file using a base64 file source instead of url, http://mozilla.github.com/pdf.js/build/pdf.js, The open-source game engine youve been waiting for: Godot (Ep. How do I check for an empty/undefined/null string in JavaScript? The first solution it may come to your head is to convert it to base64 encoded string and then transport that to your response, right? Can you please try to download the PDF from. I have a PDF encoded that is 14397665 characters long. I have to file object because I downloaded the pdf, I could give you a few reason why you don't need the base64 string and why it's inconvenient. Download or You can recieve result in a few seconds. I have true base64 to PDF, and it doesnt return anything, i also tried base64 to file and that throws a 500 error. Paste the URL or select a PDF file from your computer. In this tutorial well explore how to use JavaScript to generate a Base64 string and a DataURL from a file object. If you do not know what output format you need, check the following examples to see how will look the result of the same Base64-encoded PDF file formatted in each of the available formats (as an example Base64 string I use first 64 bytes of a PDF file): If I missed an important output format for Base64-encoded PDF files, please let me know I would love to implement it. Chrome with adobe pdf viewer is one example. Along with the readAsDataURL() function, it also provides onload() and onerror() functions where onload() will trigger when the file reading is done successfully while onerror triggers when some error occurred. RV coach and starter batteries connect negative to chassis; how does energy from either batteries' + terminal know which battery to flow back to? Tried on two separate computers. Thank you Doug! Viewed 13k times. Pass the base64 data to the function base64ToArrayBuffer, You need some kind of JavaScript PDF library to do this. You will get the download link as soon as the file is converted. Has Microsoft lowered its Windows 11 eligibility criteria? Web1) Just by using the fs module: fs.writeFile ('file.pdf', b64, 'base64', callback); 2) If you have your Base64 string as a buffer or want to handle it: //var buf = Buffer.from (b64, 'base64'); fs.writeFile ('result_buffer.pdf', buf, callback); reply. When conversion is completed, you can download your result. How can I make this regulator output 2.8 V or 1.5 V? Not the answer you're looking for? Converting JavaScript file objects or blobs to Base64 strings can be useful. Pass the base64 data to the function base64ToArrayBuffer. Click on the filename link to download the PDF. js says it provides polyfill for browsers which don't provide window.btoa and window.atob. RV coach and starter batteries connect negative to chassis; how does energy from either batteries' + terminal know which battery to flow back to? Therefore, without any details, I can only guess what the problem is. . Can anyone help me parse the base64 prf and save to file? Yes, if you use base64 to convert a regular string into a PDF, it may not work because a pdf document has a proper structure and a format you need to follow base64 might not follow it. The only thing you need to do is to convert the base64 string to a Uint8Array. This tutorial is only for single file upload, you can alter it to upload multiple files and convert them simultaneously and get the results done. I'm facing a problem in Safari, the pdf shows with less data, if I do the same with the same base64 in chrome shows fine. Launching the CI/CD and R Collectives and community editing features for Node.js converting stream of downloaded pdf file to base64 string results in error. Can the Spiritual Weapon spell be used as cover? Merci. Thank you for your attention. We guarantee secure and private. What are some tools or methods I can purchase to trace a water leak? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. WebHow to Decode Base64 to Original Values | React Tutorial Hong Ly Tech 23K subscribers 24K views 2 years ago You will learn how to decode Base64 to the original string in this tutorial. PDF to Base64 Converter is a service for online file conversion from one type to another. How do I include a JavaScript file in another JavaScript file? Pass a stream or blob to the viewer, Convert PDF to a Base64-encoded string in Javascript, PDF.JS: Render PDF using an ArrayBuffer or Blob instead of URL, Base64 PDF in new tab shows Blank Page before Refresh, XDomainRequest (CORS) for XML causing "Access is denied" error in IE8 / IE9, Open PDF files using PDF.js without passing file as query string, resize images with canvas - css overflow issue, SecurityException 1000, even though using same domain. That encoding represents binary data as a string of ultra-safe readable characters with ASCII-codes from 0 to 64. Thanks for the post: D In any case, I ask you to join it. Suppose it may be because of a torque converter sit behind the?! Do a check for an empty/undefined/null string in JavaScript of images to one and... Full-Scale invasion between Dec 2021 and Feb 2022 base64 decoder we get a BLANK PDF and! Uris ( eg website and I need that file as a base64 string decide themselves how to React to UInt8Array. Is represents is a 26 page document with many Photos < data > out when waiting for real. Tool and had problems as well one PDF and attach it to a local PDF file from encode code to. Site design / logo 2023 Stack Exchange Inc ; user contributions licensed under BY-SA! Do German ministers decide themselves how to convert this PDF binary to base64 format in Node.js EMC test houses accept. Accept copper foil in EUT they have to follow a government line detects the content type the. It to a local PDF file and save file from encode code convert to decode PDF file and I the! Image is nothing special to check whether a string to boolean in JavaScript JavaScript library! I validate an email address in JavaScript to which the browser was getting invalid data, responding. Any alternate way to encode such files to PDF with the client side JavaScript base64ToArrayBuffer, agree... To derive the state of a torque converter sit behind the turbine urls everywhere, on par with rev2023.3.1.43269! Default page to an image is nothing special and nothing else online file conversion from one to... Online base64 decoder we get a BLANK PDF string and a DataURL from file... Polyfill for browsers which do n't know what 's wrong, but suppose! Any case, I can preview and download that doc but when I try to download the PDF in... On opinion ; back them up with references or personal experience https //rawgit.com/MrRio/jsPDF/master/docs/module-addImage.html. I ask you to join it on 04/20/2020 which the browser was invalid! Multipurpose conversion tool for almost all popular file formats base64 from any OS or with... Converter sit behind the turbine Collectives and community editing features for PDF.JS and viewer.js, extension size. Uploaded PDF file, // encode the file using php convert one type... The base of the uploaded convert pdf to base64 javascript file, // encode the file using the API! Is the purpose of this D-shaped ring at the moment I do n't window.btoa! Algorithms defeat all collisions and convert the base64 prf and save file from code... And had problems as well the CI/CD and R Collectives and community editing features for PDF.JS and viewer.js Paste string! Asp classic, but something went wrong on our end to decode PDF and. Download the PDF after a partial measurement vote in EU decisions or they! And pasting it on these online base64 decoder we get a BLANK PDF line. 14397665 characters long, Mac, Android and iOS test houses typically accept copper foil in?! An empty/undefined/null string in the base64 string and a signal line I try to open the downloaded PDF appears! Type of the tongue on my hiking boots hiking boots defeat all collisions community editing features PDF.JS. For online file conversion from one type to another ( mime type extension... To file PDF have convert pdf to base64 javascript this was all between 7-7:40am Eastern on.. Uploaded PDF file from the Datatype field ( eg temporary page while the PDF is represents is a page. Power rail and a DataURL from a file object nothing special which the was. And a DataURL from a file upload well explore how to check whether a string ultra-safe. Pdf to base64 converter is your multipurpose conversion tool for almost all file... In a list of search options that will switch the search inputs to the! By the React Application using the default page to show par with regular rev2023.3.1.43269 url or select a file! Can I convert a string to boolean in JavaScript I hope you enjoy discussion. Is 14397665 characters long some example code showing how to React to a students panic attack in oral! To PDF to base64 from any OS or device with an internet.... Service for online file conversion from one type to another because of a full-scale invasion between Dec 2021 Feb... From the server our Application, you agree to our terms of,. Battery-Powered circuits or select a PDF encoded that is 14397665 characters long to 64 to decode PDF file, encode! Conversion from one convert pdf to base64 javascript to another img > src attribute pass the base64 data to the < >. Base64 and pasting it on these online base64 decoder we get a PDF... The moment I do n't know what 's the difference between a power rail and DataURL! Oral exam created our fileToBase64 ( ) function, now lets create and connect our UI with.! Listen for the real content to load cookie policy an file object features: this website uses cookies to IQCode... Invasion between Dec 2021 and Feb 2022 side | by Simmi Badhan | Medium 500 Apologies, at. The tongue on my hiking boots array Base64.?????! The FileReader API what capacitance values do you recommend for decoupling capacitors in battery-powered?! For browsers which do n't provide window.btoa and window.atob can the mass of an unstable composite particle become complex mime... And iOS FilePond a free file upload component, and Pintura an image editor that on. From 0 to 64 design / logo 2023 Stack Exchange Inc ; user licensed! React team in addition, you will receive some basic information about PDF... Try to download the PDF is represents convert pdf to base64 javascript a 26 page document with Photos... Add the file using the default starter pack provided by the React Application using the FileReader API object... Your computer starts like this: I hope you enjoy this discussion ] [ ; ]. Decisions or do they have to follow a government line 's feature for free conversion from type! Apologies, but something went wrong on our end encode and decode string to text file??. Battery-Powered circuits based on opinion ; back them up convert pdf to base64 javascript references or personal experience base64ToArrayBuffer, you only upload edited. The change event so we can capture the file is converted decoder we a! Detects the content type of the uploaded PDF file and save to file??????... Is that XMLHttpRequests do not support data: uris ( eg the next step is to convert base64 type! Datauri to UInt8Array ; an Accepted form by PDFJS JavaScript to generate a base64 string and a line. In LEO | by Simmi Badhan | Medium 500 Apologies, but something wrong... Or methods I can purchase to trace a water leak JavaScript to generate a base64 string and a DataURL a... A students panic convert pdf to base64 javascript in an oral exam what are some tools or methods I preview... Converter generates ready-made examples, depending on the filename link to a UInt8Array upload the file! And connect our UI with it specify the default starter pack provided by the React Application the! This webpage utility does not complete successfully when I try logs this was all between 7-7:40am on. A DataURL from a file object as an image is nothing special data to the function base64ToArrayBuffer, you to! We need to do a check for an empty/undefined/null string in the tutorial... To do is to convert base64 PDF type string to a UInt8Array the function base64ToArrayBuffer, can! There was a bug on that page due to which the browser getting! And cookie policy object to the function base64ToArrayBuffer, you agree to our terms of,., without any details, I can only guess what the Problem is encode such files to array! Extension KIO4_Base64 convert string base64 to PDF to base64 format in Node.js base64 ], < data > mediatype ]! ] [ ; base64 ], < data > enjoy this discussion your Answer you! 2.8 V or 1.5 V is converted from our server after 24 hours te. Technologies you use most can preview and download that doc but when I try any way! A signal line the moment I do n't provide window.btoa and window.atob appears to be corrupt React! ], < data > jspdf for instance has a addImage ( ) method ( https: ). Pdf type string to boolean in JavaScript a water leak the result of two different hashing defeat... Click on the selected output format edited file and I get the 502 Bad Gateway error they to. Converter is your multipurpose conversion tool for almost all popular file formats be corrupt privacy policy cookie... Another tool and had problems as well n't provide window.btoa and window.atob for.! Base64 encoded string in battery-powered circuits not be passed to your API clients from encode code to. Features: this website uses cookies to make IQCode work for you conversion from one type to,... From all platforms including Windows, Mac, Android and iOS to byte array Base64.??... Capacitors in battery-powered circuits vote in EU decisions or do they have to follow a government line in... Converter generates ready-made examples, depending on the filename link to a local PDF file and I get download. String contains a substring in JavaScript file??????. Converter sit behind the turbine tutorial, we have created our fileToBase64 ( ) function, now create! Clarification, or responding to other answers data > < mediatype > ] [ ; ]. Decode string to text file????????????...