Using HTML2PDF with a proxy

Q. I am evaluating the HTML2PDF sample for an use case to convert WebPages into PDF documents.
Downloaded the evaluation version of PDFNet (.NET 4, 32-bit windows) & the HTML to PDF conversion module and placed the html2pdf.dll file in the Lib folder along with the PDFNet.dll.I tried executing the sample project file (HTML2PdfTest), but I am facing issues with the first 3 examples provided in the code. The PDF files are not being generated for the first 2 examples and for the 3rd, the PDF is being created without any webpage contents. Example 4 is good.
For the first 2 examples, executing step by step reveals that the code just skips the…part without displaying any messages.
Can you please help me on this or do I need to reach out to a separate support group for this? Please let me know.


You need to inform HTML2PDF of the proxy server settings to use. Try the code below, after setting the port and host ip to your case of course. If your proxy requires a username and password, then you can supply those also.

Note that the proxy settings are set for each call to InsertFromURL() and InsertFromHtmlString().

using (PDFDoc doc = new PDFDoc())
HTML2PDF converter = new HTML2PDF();
HTML2PDF.Proxy proxy = new HTML2PDF.Proxy();
proxy.SetType(HTML2PDF.Proxy.Type.e_http); // or Socks
HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
converter.InsertFromURL(host + page0, settings);
if (converter.Convert(doc))
doc.Save(output_path + “_proxy_03.pdf”, SDFDoc.SaveOptions.e_linearized);