I am trying to convert webpage into pdf using itextsharp,
Following is the c# code I am using
protected void btnExport_Click(object sender, EventArgs e)
{
try
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 5f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
StyleSheet ST = new StyleSheet();
FontFactory.Register("c:\\windows\\fonts\\Times.ttf");
ST.LoadTagStyle("body", "face", "Times New Roman");
ST.LoadTagStyle("body", "size", "15px");
htmlparser.SetStyleSheet(ST);
//XMLWorkerHelper worker = XMLWorkerHelper.GetInstance();
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
catch (Exception EX)
{ }
}
below is a source code:
| | |
1. Personal Details | ||
| Name* (Same as ID proof): | ||
Maiden name (If any)* : | ||
Father's/Spouse Name* : | ||
Mother name* : | ||
Date of birth* : | Gender* : |
Marital status* : | Citizenship* : |
Residential status* : | Occupation Type* : |
| Pan card* : | Adhar Card* : |
2. Residence for tax purposes in jurisdiction(s) outside India | |
| | |
| ISO 3166 Country Code of Jurisdiction of Residence* : | |
| Tax Identification Number* : | |
| Place/City of Birth*: | ISO 3166 Country Code*: |
| ADDRESS IN THE JURISDICTION DETAILS WHERE APPLICANT IS RESIDENT OUTSIDE INDIA FOR TAX PURPOSE* | |
| Address: | |
| City/Town/Village: | Pincode: |
| ISO 3166 Country code: | State code: |
3. Address | |
| Address : | |
| City/Town/Village: | Pincode: |
| District: | ISO 3166 Country code: |
| State code: | |
| CORRESPONDENCE/LOCAL ADDRESS DETAILS*: | |
| | |
| Address: | |
| City/Town/Village: | Pincode: |
| District: | ISO 3166 Country code: |
| State code: | |
4. Contact Details | |
| Mobile: | Email Id: |
5. Applicant Decalartion | |
| I here by declare that the details furnished above are true and correct to the best of my knowledge and belief and I undertake to inform you of any changes therein. immediately. In case any of the above information is found to be false or untrue or misleading or misrepresenting. I am aware that I may be held liable for it | |
| DATE : | Place : |
| | |
Annexture- 3 | |||
TRADING AND DEMAT ACCOUNT RELATED DETAILS | |||
| A. NAME OF THE APPLICANT | |||
| Trading Account Holder Name: | DP Holder Name: | ||
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Arul RethinamPosted Nov 2, 2017, 9:03 AM