Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After some testing, this is what you need to do:</p> <ul> <li>Create a Folder in which you will have all of your Images.</li> <li>If you already have an instance of <code>Pdfizer.HtmlToPdfConverter</code> change the <code>ImagePath</code> Attribute to point to the folder where your images reside.</li> <li>Include the <code>&lt;img&gt;</code> tags in your html code.</li> <li>Make sure the images are in the folder.</li> </ul> <p>Note: I tried adding Png files and got a conversion error. Here is an example I took from the site you provided, plus my modifications:</p> <pre><code>System.Text.StringBuilder sbHtml = new System.Text.StringBuilder(); sbHtml.Append("&lt;html&gt;"); sbHtml.Append("&lt;body&gt;"); sbHtml.Append("&lt;font size='14'&gt;My Document Title Line&lt;/font&gt;"); sbHtml.Append("&lt;img src='trollface.jpg' /&gt;"); sbHtml.Append("&lt;br /&gt;"); sbHtml.Append("This is my document text"); sbHtml.Append("&lt;/body&gt;"); sbHtml.Append("&lt;/html&gt;"); //create file stream to PDF file to write to using (System.IO.Stream stream = new System.IO.FileStream (sPathToWritePdfTo, System.IO.FileMode.OpenOrCreate)) { // create new instance of Pdfizer Pdfizer.HtmlToPdfConverter htmlToPdf = new Pdfizer.HtmlToPdfConverter(); // open stream to write Pdf to to htmlToPdf.Open(stream); htmlToPdf.ImagePath = Server.MapPath(ResolveUrl("~/Images")); // write the HTML to the component htmlToPdf.Run(sbHtml.ToString()); // close the write operation and complete the PDF file htmlToPdf.Close(); } } </code></pre> <p>Good luck!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload