Solved

Convert xml base64binary to a pdf file

Posted on 2010-08-22
7
910 Views
Last Modified: 2012-05-10
Hi,
I have an xml that contains a pdf in the form of a base64binary in an xml field.
I need to know how to decode the string and convert it back into a pdf?
0
Comment
Question by:rohan_koudinya
  • 4
  • 3
7 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 33495372
try:

Encoding.Default.GetString(System.Convert.FromBase64String(<base64binary_data>))
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33495375
replace <base64binary_data> with the base64binary content from the xml.
0
 

Author Comment

by:rohan_koudinya
ID: 33495393
Actually the Data is represented as a byte[] in the code and out of that byte[] i need to put it into a file..
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 42

Expert Comment

by:sedgwick
ID: 33495409
to convert byte[] to string:

byte[] myByteArray;
System.Text.Encoding enc = System.Text.Encoding.ASCII;
string myString = enc.GetString(myByteArray);
0
 

Author Comment

by:rohan_koudinya
ID: 33495470
[System.Xml.Serialization.XmlAttributeAttribute(DataType="base64Binary")]
    public byte[] InvoiceFile {
        get {
            return this.invoiceFileField;
        }
        set {
            this.invoiceFileField = value;
        }
    }
this is the the field property generated out of the given xml, will your solution fit into this?
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 33495504
yes, first convert it to string using my 2nd post, then convert it to regular string using my 1st post.
0
 

Author Closing Comment

by:rohan_koudinya
ID: 33497974
Thanks!
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question