Nageshwar Rao

Nageshwar Rao

  • NA
  • 74
  • 35.1k

Convert html to pdf

Sep 7 2016 11:37 AM
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 

Answers (5)