// // 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); }
// // 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); }
// // 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); }
// // 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(); }
// // 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)); }