Table of Contents
HtmlToPdf.ConvertHtml Method (String, Stream)

Convert HTML text to PDF and write output to a Stream object.

 public static HtmlToPdfResult ConvertHtml(
   string html,
   Stream stream


The html text.
The output stream.

Return Value

Returns a HtmlToPdfResult object that contains additional information about the conversion.


Use this version to save the PDF directly to a stream without creating a file, which is especially useful in a Web application. For example, the following saves the output directly to the OutputStream of the current HttpResponse object.

//Convert Url to PDF and send the result directly to the client
HtmlToPdf.ConvertUrl("", Response.OutputStream);
Note: Usually you must set HtmlToPdf.Options.BaseUrl before calling this method.
See Also