在按钮上单击跳转到pdf页面 [英] on button click jump to pdf page

查看:390
本文介绍了在按钮上单击跳转到pdf页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在VB中跳转到按钮并单击跳到pdf页面

how can jump page to button click to pdf page in VB

推荐答案

using iTextSharp.text.pdf;
using iTextSharp.text.html;
using iTextSharp.text.html.simpleparser;

protected void Btn_Click(object sender, EventArgs e)
    {
	string myString ="<html></html>"; // this will be whole html doucment

        string attachment = "File_Name.pdf";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/pdf";
        StringWriter stw = new StringWriter();
        HtmlTextWriter htextw = new HtmlTextWriter(stw);
        iTextSharp.text.Document document = new iTextSharp.text.Document();
        PdfWriter.GetInstance(document, Response.OutputStream);
        document.Open();
        StringReader str = new StringReader(myString);
        HTMLWorker htmlworker = new HTMLWorker(document);
        htmlworker.Parse(str);
        document.Close();
        Response.Write(document);
        Response.End();

}


这篇关于在按钮上单击跳转到pdf页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆