I have a HTMLEditor(ajax control). i am converting the contents present in HTMLEditor into pdf as followsprotected void Button2_Click(object sender, EventArgs e) String dbDate = DateTime.ParseExact(TextBox3.Text, “dd/mm/yyyy”, null).ToString(“yyyy-mm-dd”); //Extract data from Page (pd). //Label16.Text = Editor1.Content; // Attribute // makae ready HttpContext HttpContext.Current.Response.Clear(); HttpContext.Current….
via C Programming Language Tutorial » Search Results » ajax:
‘Enter’ is not recognised during pdf conversion in c#
I have a HTMLEditor(ajax control). i am converting the contents present in HTMLEditor into pdf as follows
protected void Button2_Click(object sender, EventArgs e)
String dbDate = DateTime.ParseExact(TextBox3.Text, “dd/mm/yyyy”, null).ToString(“yyyy-mm-dd”);
//Extract data from Page (pd).
//Label16.Text = Editor1.Content; // Attribute
// makae ready HttpContext
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = “application/pdf”;
// Create PDF document
Document pdfDocument = new Document(PageSize.A4, 80, 50, 30, 65);
PdfWriter wri = PdfWriter.GetInstance(pdfDocument, new FileStream(“d://” + HiddenField1.Value + HiddenField4.Value + dbDate + “.pdf”, FileMode.Create));
PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream);
pdfDocument.Open();
string htmlText = Editor1.Content;
System.Collections.Generic.List
for (int k = 0; k < htmlarraylist.Count; k++)
pdfDocument.Add((IElement)htmlarraylist[k]);
pdfDocument.Close();
HttpContext.Current.Response.End();
}Now the problem is if i press enter in HTMLEditor, the generated pdf does not show any change .
I have already hardcoded some contents into HTMLEditor:
“
” + “
“+”By Order of the Court,”.Replace(Environment.NewLine,”
“)+”
“
” + “
( G. M. Redker ) ” +
“
” + “Assistant Registrar ” +
“
” + “High Court of Bombay” +
“
” + “Panaji Bench (Goa) ” + “
i.e if i press enter key after a line,than pdf does not show any gap between two lines it displays a continuous line.
All this happens only when i deploy application on server,my development machine shows a proper output.
Is this error because i am doing the followin:
string htmlText = Editor1.Content;
System.Collections.Generic.List
for (int k = 0; k < htmlarraylist.Count; k++) pdfDocument.Add((IElement)htmlarraylist[k]);
Please help me to solve my problem
……………………………………..
Normally, whitespace is collapsed in html, so this behavior seems normal. Use a
tag to simulate a new line, or use
tags.
For more info: ‘Enter’ is not recognised during pdf conversion in c#
C Programming Language Tutorial » Search Results » ajax