//// This code is part of Document Solutions for Imaging demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem;usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Drawing;usingGrapeCity.Documents.Text;usingGrapeCity.Documents.Imaging;usingGCTEXT = GrapeCity.Documents.Text; namespaceDsImagingWeb.Demos{ // This sample uses the same code as in the HelloWorld sample// to create an image with the "Hello, World!" text, but in addition// adds company logo copied from the MESCIUS home page// using DsHtml.// // Please see notes in comments at the top of HelloWorldHtml// sample code for details on adding DsHtml to your projects.publicclassGcLogoHtml {publicGcBitmapGenerateImage(Size pixelSize, float dpi, bool opaque, string[] sampleParams = null) {// MESCIUS home page:var uri = newUri("https://developer.mescius.com/");// The coordinates of the logo on the home page:var logoRc = newRectangleF(5, 5, 350, 80); // Create the "Hello, World!" image like in the HelloWorld sample:var blue = Color.FromArgb(unchecked((int)0xFF2e4884));var bmp = newGcBitmap(pixelSize.Width, pixelSize.Height, true, dpi, dpi);using (var g = bmp.CreateGraphics(blue)) {var rc = newRectangleF(0, 0, pixelSize.Width, pixelSize.Height);var b = newRadialGradientBrush(Color.White, blue, newPointF(0.5f, 0.5f), true); g.FillRectangle(rc, b);var tf = newTextFormat {Font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "FreeSerifBold.ttf")),FontSize = 64,ForeColor = Color.OrangeRed, }; g.DrawString("Hello, World!", tf, rc, TextAlignment.Center, ParagraphAlignment.Center, false); // Copy and paste the logo from onto the image, scaled x2:var fmt = newHtmlToImageFormat(false, false) {FullPage = false,MaxWindowWidth = 300,MaxWindowHeight = 300,Clip = logoRc,Scale = 2 };// Create an instance of GcHtmlBrowser that is used to render HTML:usingvar browser = Common.Util.NewHtmlBrowser(); // Draw HTML: g.DrawHtml(browser, uri, pixelSize.Width - logoRc.Width * fmt.Scale, 0, fmt, outSizeF s); }return bmp; } }}