Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please tell me
please help me how i can create a pdf on the server from where i purchase a domain please help me i use itext object it work on my local-host not work on go daddy domain please help me
Posted

use this code on button click definatly it will work

C#
Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=Export.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            HtmlForm frm = new HtmlForm();
            grdMissingBarcode.Parent.Controls.Add(frm);
            frm.Controls.Add(grdMissingBarcode);
            frm.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
            Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            pdfDoc.NewPage();
            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();
 
Share this answer
 
Comments
irfanansari 16-Nov-11 2:29am    
faizan bhai it will work on secure server as i purchase from go daddy please tell me kindly
irfanansari 16-Nov-11 6:16am    
Is there any file import?

and it will convert all page ?
if i want to some fields to convert so please tell me how i can do this please
You need to check with the hosting company if your application has access to create the files there. Make sure it is secure enough to leave those PDF files on third party hardware.
 
Share this answer
 
Comments
irfanansari 16-Nov-11 2:28am    
so please tell me any other way please create a pdf and send it bcs server very secure
irfanansari 16-Nov-11 6:18am    
Please the way to converts and create a pfd file at same domain website is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900