In Place HTML to Image Object

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(0, 0, "HTML document screenshot:", pdfFontEmbed);
titleTextHtmlImage.ForeColor = PdfColor.Navy;
document.Layout(titleTextHtmlImage, 10);

string htmlFile = "http://www.hiqpdf.com/ClientDemo" + @"/DemoFiles/Html/Logo.Html";

PdfHtmlImage htmlRasterImage = new PdfHtmlImage(0, 0, htmlFile);
htmlRasterImage.BrowserWidth = 400;
document.Layout(htmlRasterImage, 10);

#endregion

See Also