Solved

Convert xml base64binary to a pdf file

Posted on 2010-08-22
7
896 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now