Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Convert xml base64binary to a pdf file

Posted on 2010-08-22
7
Medium Priority
?
932 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:Meir Rivkin
ID: 33495372
try:

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

Expert Comment

by:Meir Rivkin
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 42

Expert Comment

by:Meir Rivkin
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:
Meir Rivkin earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

916 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