Hi all, i am working on converting the asp.net to pdf file..
now i'm using this code,but it give me an error "Type or namaspace name 'pdfConverter' could not be found"..
is there any component i need to install..any help plz?

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.GenerateSelectablePdf = 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.LicenseKey = "put your serial number here";
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();

Recommended Answers

Dear Sir,

I have seen one website that usful of export to the pdf file.
You can see by this link: http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspx

I hope it is helpful for your work.

Jump to Post

All 3 Replies

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.