Convert xml base64binary to a pdf file

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?
rohan_koudinyaAsked:
Who is Participating?
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
yes, first convert it to string using my 2nd post, then convert it to regular string using my 1st post.
0
 
Meir RivkinFull stack Software EngineerCommented:
try:

Encoding.Default.GetString(System.Convert.FromBase64String(<base64binary_data>))
0
 
Meir RivkinFull stack Software EngineerCommented:
replace <base64binary_data> with the base64binary content from the xml.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
rohan_koudinyaAuthor Commented:
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
 
Meir RivkinFull stack Software EngineerCommented:
to convert byte[] to string:

byte[] myByteArray;
System.Text.Encoding enc = System.Text.Encoding.ASCII;
string myString = enc.GetString(myByteArray);
0
 
rohan_koudinyaAuthor Commented:
[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
 
rohan_koudinyaAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.