static void Main(string[] args) { // Convert HTML to JPEG SautinSoft.PdfVision v = new SautinSoft.PdfVision(); // Set "Edge mode" to support all modern CSS. SautinSoft.PdfVision.TrySetBrowserModeEdgeInRegistry(); string inpFile = @"https://nationalzoo.si.edu"; FileInfo outFile = new FileInfo("Result.jpg"); v.ImageStyle.JPEGQuality = 95; int ret = v.ConvertHtmlFileToImageFile(inpFile, outFile.FullName, SautinSoft.PdfVision.eImageFormat.Jpeg); // 0 - converting successfully // 1 - can't open input file, check the input path // 2 - can't create output file, check the output path // 3 - converting failed if (ret == 0) { // Open the produced JPEG image in a default Viewer. System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile.FullName) { UseShellExecute = true }); } }
public void PrintScreen(string sFileName, string _CurrentResponseString) { try { string sHTML = _CurrentResponseString; if (sHTML != null)//namrata { string HTMLFile = Path.ChangeExtension(sFileName, ".html"); File.WriteAllText(HTMLFile, sHTML.Trim()); SautinSoft.PdfVision _vision = new SautinSoft.PdfVision(); SautinSoft.PdfVision.TrySetBrowserModeEdgeInRegistry(); _vision.PageStyle.PageOrientation.Auto(); _vision.ConvertHtmlFileToImageFile(HTMLFile, sFileName, SautinSoft.PdfVision.eImageFormat.Png); } } catch (Exception e) { throw e; } }