An In Place HTML to Image Object is represented by the PdfHtmlImage class. An object of this class can be laid out in any position in a PDF document to render a HTML content as image. Multiple objects of this type can be laid out in the same PDF page and even overlapped.
In Place HTML to Image Object Demo
The sample code below is taken from the PDF Images topic.
Demo Source Code
C#
#region Layout the screenshot of a HTML document PdfText titleTextHtmlImage = new PdfText(crtXPos, crtYPos, "HTML document screenshot:", pdfFontEmbed); titleTextHtmlImage.ForeColor = Color.Navy; textLayoutInfo = crtPage.Layout(titleTextHtmlImage); // advance the Y position in the PDF page crtYPos += textLayoutInfo.LastPageRectangle.Height + 10; string htmlFile = Application.StartupPath + @"\DemoFiles\Html\Logo.Html"; PdfHtmlImage htmlRasterImage = new PdfHtmlImage(crtXPos, crtYPos, htmlFile); htmlRasterImage.BrowserWidth = 400; PdfLayoutInfo htmlLayoutInfo = crtPage.Layout(htmlRasterImage); // advance the Y position in the PDF page crtYPos += htmlRasterImage.ConversionInfo.PdfRegions[0].Rectangle.Height + 10; #endregion
See Also