Solved

Convert xml base64binary to a pdf file

Posted on 2010-08-22
7
906 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

785 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