TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nirmal Roy
NA
365
29.4k
How to convert pdf in C# But another Button should bevisable
Mar 8 2017 5:00 AM
How to convert pdf in C# But another Button should be visable?
here I have done function but i want to visible buton (Button2) after download files . How is it posible? Plsase help me.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Button2.Visible = false;
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
private void generatetable(string filename)
{
try
{
BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1257, false);
Font ChronicleFont = new Font(bfTimes, 1, Font.NORMAL);
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=" + filename + "");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
ftdiv.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4.Rotate(), 25, 25, 25, 25);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
MemoryStream memoryStream = new MemoryStream();
string folderpath = "SurveyReport/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
string directoryPath = Server.MapPath(string.Format(folderpath));
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
PdfWriter.GetInstance(pdfDoc, new FileStream(Server.MapPath(folderpath) + filename, FileMode.Create));
}
else
{
PdfWriter.GetInstance(pdfDoc, new FileStream(Server.MapPath(folderpath) + filename, FileMode.Create));
}
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
//Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery);
Response.End();
}
catch
{
//System.Threading.Thread.Sleep(6000);
Button2.Visible = true;
}
}
Reply
Answers (
4
)
How to Dynamic Multiple file upload
What is the difference between web api get and post