i have tried with different .net packages.my code is like this
using System;
using EO.Pdf;
using System.Drawing;
using System.Web;
namespace HTMLtoPDF5
{
class Program
{
static void Main(string[] args)
{
try
{
string Url = "https://v16smoke.smartappbeta.com/enterprisedesktop/DocumentItemDetails.aspx?smartItemId=1610934&sessionid=c4c515ca90724e0e964aae9256b146b0&pageMode=view";
HtmlToPdfOptions opts = new HtmlToPdfOptions();
opts.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;
opts.AutoFitY = HtmlToPdfAutoFitMode.None;
opts.ZoomLevel = 1;
// opts.NoScript = true;
// opts.PageSize = PdfPageSizes.A4;
opts.OutputArea = new System.Drawing.RectangleF(0.5f, 0.5f, 8.267f, 11.692f);
HtmlToPdf.ConvertUrl(Url, @"C:\Pictures\Testing2.pdf", opts);
}
catch (Exception ex)
{
Console.WriteLine("Error");
}
}
}
}
but contents in the html are not getting in pdf only few are getting remaining contents are not visible nut two pages are getting in pdf,one is empty 
Nilesh JadavRank #109 · 20.3K reputationPosted Sep 7, 2016, 5:32 PM EDT
Try with this tool - wkhtmtopdf it will give you optimal result in viewing.
Rahul PrasadRank #2,557 · 546 reputationPosted Sep 8, 2016, 5:30 PM EDT
Marvin ReidRank #1,963 · 746 reputationPosted Jun 13, 2022, 1:13 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Jun 13, 2022, 11:28 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Jun 14, 2022, 2:48 AM EDT
Usage
- Download HtmlRenderer.PdfSharp nuget package.
- public static Byte[] PdfSharpConvert(String html)
- {
- Byte[] res = null;
- using (MemoryStream ms = new MemoryStream())
- {
- var pdf = TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(html, PdfSharp.PageSize.A4);
- pdf.Save(ms);
- res = ms.ToArray();
- }
- return res;
- }
ref link: https://stackoverflow.com/questions/564650/convert-html-to-pdf-in-netUse Example Method.