htmltopdf.zip
Hai When i am converting Html to Pdf more than 5mb It will take more than 5 minutes and that conversion also not Exact.
This is my code Please reffer:
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = HttpContext.Current.Server.MapPath("~/bin/plugins");
//Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = @"C:\inetpub\wwwroot\WebAPI\bin\plugins";
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(htmlFilePath, PDFFilePath,
//enable javascript
true,
//load timeout
100 * 100,
//page size
new SizeF(612, 792),
//page margins
new PdfMargins(0, 0));
string pdf_url_seperate_filename = getFilename(PDFFilePath);
Spire.Pdf.PdfDocument origDoc = new Spire.Pdf.PdfDocument();
origDoc.LoadFromFile(PDFFilePath);
Spire.Pdf.PdfDocument destDoc = new Spire.Pdf.PdfDocument();
foreach (Spire.Pdf.PdfPageBase page in origDoc.Pages)
{
PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
Spire.Pdf.Graphics.PdfMargins margin = new Spire.Pdf.Graphics.PdfMargins();
margin.Top = unitCvtr.ConvertUnits(0f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Bottom = margin.Top;
margin.Left = unitCvtr.ConvertUnits(0f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Right = margin.Left;
Spire.Pdf.PdfPageBase newPage = destDoc.Pages.Add(Spire.Pdf.PdfPageSize.Letter, margin);
newPage.Canvas.ScaleTransform(1.25f, 1.26f); /*735*/
newPage.Canvas.DrawTemplate(page.CreateTemplate(), new PointF(0, 0));
}
destDoc.SaveToFile(PDFFilePath, Spire.Pdf.FileFormat.PDF);
Login to view the files attached to this post.