Hi Team,
How do I set the converted html to fit into a single page pdf?
var htmlContent = RenderViewToString(ControllerContext, viewPath, model, true);
PdfPage page = document.Pages.Add();
SizeF pageSize = SizeF.Empty;
PdfUnitConvertor convertor = new PdfUnitConvertor();
float width = -1;
float height = -1;
width = convertor.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);
height = convertor.ConvertToPixels(page.GetClientSize().Height, PdfGraphicsUnit.Point);
// Create a new instance of HtmlConverter class.
WebKitHtmlConverter html = new WebKitHtmlConverter();
//WebKit assembly path
string WebKitBinaryPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "QTBinaries");
html.WebKitPath = WebKitBinaryPath;
// Convert to metafile.
HtmlToPdfResult result = html.Convert(htmlContent, viewPath, (int)width, (int)height);
// Draw metafile in PdfPage.
result.Render(page, metafileFormat);
//Save pdf on location