hi ...
i tried this library, but this is giving some errors ...
pdfConverter.LicenseFilePath = System.IO.Path.Combine(Server.MapPath("~"), "Bin");
i suppose i am not having that licence ...
then what i did is, commented this piece of code ...
finally the file is generated as i wanted but with a message written in file as "Evaluation Version ..."
is there any other other method so that i can bypass the message of "Evaluation Version" in the generated pdf.
please help ...
thanks ...
Hi,
Here is a .NET 2.0 library for html to pdf conversion: www.html-to-pdf.net.
Here is some code sample from their website:
PdfConverter pdfConverter = new PdfConverter();pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;pdfConverter.PdfDocumentOptions.ShowHeader = true;pdfConverter.PdfDocumentOptions.ShowFooter = true;pdfConverter.PdfDocumentOptions.LeftMargin = 5;pdfConverter.PdfDocumentOptions.RightMargin = 5;pdfConverter.PdfDocumentOptions.TopMargin = 5;pdfConverter.PdfDocumentOptions.BottomMargin = 5;pdfConverter.PdfDocumentOptions.UseMetafileFormat = true;pdfConverter.PdfDocumentOptions.ShowHeader = false;//pdfConverter.PdfHeaderOptions.HeaderText = "Sample header: " + TxtURL.Text;//pdfConverter.PdfHeaderOptions.HeaderTextColor = Color.Blue;//pdfConverter.PdfHeaderOptions.HeaderDescriptionText = string.Empty;//pdfConverter.PdfHeaderOptions.DrawHeaderLine = false;pdfConverter.PdfFooterOptions.FooterText = "Sample footer: " + TxtURL.Text + ". You can change color, font and other options";pdfConverter.PdfFooterOptions.FooterTextColor = Color.Blue;pdfConverter.PdfFooterOptions.DrawFooterLine = false;pdfConverter.PdfFooterOptions.PageNumberText = "Page";pdfConverter.PdfFooterOptions.ShowPageNumber = true;pdfConverter.LicenseFilePath = System.IO.Path.Combine(Server.MapPath("~"), "Bin");byte[] downloadBytes = pdfConverter.GetPdfFromUrlBytes(url);System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;response.Clear();response.AddHeader("Content-Type", "binary/octet-stream");response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName + "; size=" + downloadBytes.Length.ToString());response.Flush();response.BinaryWrite(downloadBytes);response.Flush();response.End();
See the original code sample here:
http://www.html-to-pdf.net/Support.aspx#csharp