Exemple #1
0
        //
        // Fetch the list of image sources from the url
        //
        static public List <string> LoadDocumentImages(String url)
        {
            WebPageBitmap wpb = new WebPageBitmap(url, null, 0, 0, false);

            Invoke(wpb);

            return(wpb.ImageSrc);
        }
Exemple #2
0
        //
        // Create a bitmap from a url
        //
        static public Bitmap Fetch(String url, int width, int height)
        {
            WebPageBitmap wpb = new WebPageBitmap(url, null, width, height, true);

            Invoke(wpb);

            return(wpb.Bitmap);
        }
Exemple #3
0
        //
        // Create a bitmap from an html stream
        //
        static public Bitmap LoadStream(MemoryStream stream, int width, int height)
        {
            WebPageBitmap wpb = new WebPageBitmap(null, stream, width, height, true);

            Invoke(wpb);

            return(wpb.Bitmap);
        }
Exemple #4
0
        //
        // Run the WebBrowser control in a single apartment thread
        //
        static private void Invoke(WebPageBitmap wpb)
        {
            Thread thread = new Thread(wpb.Load);

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();
        }
Exemple #5
0
        //
        // Build a bitmap from an xsl file and an xml document
        //
        static public Bitmap LoadXsl(string fileName, XmlDocument doc, int width, int height)
        {
            // Load the style sheet.
            XslCompiledTransform xslt = new XslCompiledTransform();

            xslt.Load(fileName);

            // Execute the transform and output the results to a stream.
            MemoryStream stream  = new MemoryStream();
            XmlWriter    results = XmlWriter.Create(stream);

            xslt.Transform(doc, results);
            results.Close();

            return(WebPageBitmap.LoadStream(stream, width, height));
        }