none
print edited html in c# RRS feed

  • 질문

  • explain of My working process =>

    I have server. when my client program ask server to get the printing form ( that set image on right position, and texts are on right position) . 

    After I got that html to string, i change some word to fit in client program.

    (ex)

    WWW www = new WWW(@"http://www.server.com/aaa1.html");
    
            yield return www;
           
            if (!string.IsNullOrEmpty(www.error))
            {
                Debug.Log(www.error + " : error Occur");
            }
            else
            {
                byte[] bytesForEncoding = Encoding.UTF8.GetBytes(www.text);
                string encodedString = Convert.ToBase64String(bytesForEncoding);
    
                byte[] decodedBytes = Convert.FromBase64String(encodedString);
                string decodedString = Encoding.UTF8.GetString(decodedBytes);
    
                string new_html = decodedString.Replace("{need_editText}", client_Text);


    )

    so I have edited string - new_html. that <html><body>...</body></html> like this.

    and now i want to print it. the paper. i tried, but i can't. once the printer works, but it print <html></html> samely.

    I want just content, not all codes include <html> thing. i want the batching of images, and texts on batching html form, on paper.

    Webbrowser said 

        private void PrintHelpPage(string _a)
        {
            // Create a WebBrowser instance. 
            WebBrowser webBrowserForPrinting = new WebBrowser();
    
            // Add an event handler that prints the document after it loads.
            webBrowserForPrinting.DocumentCompleted +=
                new WebBrowserDocumentCompletedEventHandler(PrintDocument);
    
            // Set the Url property to load the document.
    //webBrowserForPrinting.Url = new Uri(@"          "); //
        }

    but I don't know How Can i get Uri. I tried to save string and make .html file and print it. it doesn't work.

    so i fill Uri(@"server address") but it doesn't work too.

    error said 

    UriFormatException: Invalid URI: The format of the URI could not be determined: stackoverflow.com System.Uri..ctor (System.String uriString, Boolean dontEscape) System.Uri..ctor (System.String uriString) 

    Somebody helps...

    * Add. I'm working on Unity, and I'm build standalone (PC, Window)
    • 편집됨 soran01 2017년 11월 24일 금요일 오전 2:36
    2017년 11월 24일 금요일 오전 2:35