locked
Open a Document File From Base

    Question

  • Hi,

    I am developing a Windows Store App which consumes a web service. It gets a base64 string from the web service. It should convert the base64 string to a Word or PDF document according to its type, and launch with " await Windows.System.Launcher.LaunchFileAsync(file) " code line.

    It gets the base64 string, converts it to byte array. But I do not know how to create a file by this base64 string or byte array and open the file.

    Could you please help me to do this.

    Thanks a lot.

    Wednesday, October 01, 2014 7:28 AM

Answers

  • 1) Create a StorageFile with the extension ".pdf"

    2) Write your bytes to this file using Windows.Storage.FileIO.WriteBytesAsync
    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync.aspx

    3) Use LaunchFileAsync(<StorageFile>)


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, October 01, 2014 1:25 PM
    Moderator