View Single Post
  #1 (permalink)  
Old June 28th, 2007, 12:00 AM
net_hunk net_hunk is offline
Registered User
Join Date: Jun 2007
Location: hyd, ap, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default using Page.RenderControl()

I have a webpage which is displayed a series of times with different controls each time.

I have a function which has the code to generate the controls dynamically which is a called in the next button.

Now my requirement is that, whenever the user clicks the next button I have to capture the current page with the controls and the data in it (static) in the form of pdf file and finally at the last when the user clicks the submit button I have to merge the pdf files and pop it up .

To generate the pdf I am using a third party dll which needs html source of the page so to get that i am using the following code

protected void ExportToPDF()

System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

string pageSoure = oStringWriter.ToString();

PdfConverter pdfcon = new PdfConverter();
pdfcon.LicenseFilePath = Server.MapPath("Bin/");
pdfcon.PageWidth = 900;
pdfcon.PdfDocumentOptions.LeftMargin = 25;
pdfcon.PdfDocumentOptions.RightMargin = 25;
pdfcon.AvoidTextBreak = true;
pdfcon.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
pdfcon.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
pdfcon.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;
pdfcon.SavePdfFromHtmlStringToFile(pageSoure, Request.PhysicalApplicationPath + @"\temp\" + pageID.ToString() + ".pdf");

pageSoure = "";


here I am using a third party dll to convert to pdf wen i call this function in the next button I am getting an http error as "A page can have only one server-side Form tag."

Please help me regarding this .

Thanks in advance

Reply With Quote