locked
Save file in the memory

    Question

  • I am writing an 3d printing application. My files are on the server and I have print the files without saving it on the hard disk. 

    I am thinking to stream the file on the server and then print it.

    How should I stream the file on the server ? and then send it to printer to print it ? 

    Tuesday, June 24, 2014 11:12 PM

Answers

  • Hi,

    As far as I know, windows store app cannot just print a file. The app needs to describe how the file is rendered. The Print sample demonstrates how to print your app's own pages. For example if you want to print a Word document your app would need to be able to understand and display Word files. For Stream a file on the server, you can use HttpClient, some codes below:

    var url = new Uri( "http://comment.bilibili.tv/693437.xml");
    
                var client = new HttpClient();
    
                using (var stream = await client.GetStreamAsync(url))
                {
                    ......
    
                }
    

    You can refer to the link to get more information:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.web.http.httpclient.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, June 25, 2014 3:16 AM

All replies

  • Hi,

    As far as I know, windows store app cannot just print a file. The app needs to describe how the file is rendered. The Print sample demonstrates how to print your app's own pages. For example if you want to print a Word document your app would need to be able to understand and display Word files. For Stream a file on the server, you can use HttpClient, some codes below:

    var url = new Uri( "http://comment.bilibili.tv/693437.xml");
    
                var client = new HttpClient();
    
                using (var stream = await client.GetStreamAsync(url))
                {
                    ......
    
                }
    

    You can refer to the link to get more information:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.web.http.httpclient.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, June 25, 2014 3:16 AM
  • Can I use the HTTPclient method in desktop application as well ? if yes then how can i convert stream returned by 

    GetStreamAsync

    into Comptr<IStream> ?

    Thursday, July 03, 2014 8:02 AM