如何用pdf进行设计 [英] how to make design in pdf

查看:56
本文介绍了如何用pdf进行设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设计由asp.net创建的pdf


how to design a pdf which is created by asp.net


Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=UserDetails.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            HtmlForm frm=new HtmlForm();
            GridView1.AllowPaging = false;
            DropDownList1.Parent.Controls.Add(frm);
            frm.Attributes["runat"] = "server";
            frm.Controls.Add(DropDownList1);
            GridView1.Parent.Controls.Add(frm);
            frm.Attributes["runat"] = "server";
            frm.Controls.Add(GridView1);
            frm.RenderControl(hw);
       
            //frm.RenderControl(hw);
            //GridView1.DataBind();
            //GridView1.RenderControl(hw);
            //GridView1.HeaderRow.Style.Add("width", "15%");
            //GridView1.HeaderRow.Style.Add("font-size", "10px");
            //GridView1.Style.Add("text-decoration", "none");
            //GridView1.Style.Add("font-family", "Arial, Helvetica, sans-serif;");
            //GridView1.Style.Add("font-size", "8px");
            StringReader sr = new StringReader(sw.ToString());
            Document pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();





this the code to create pdf in this where to make change to get some design in pdf?

推荐答案

同意. iTextSharp是满足您需求的最佳工具.参考: http://sourceforge.net/projects/itextsharp/ [
Agreed. iTextSharp is the best tool for your need. Ref at: http://sourceforge.net/projects/itextsharp/[^]


在上面的代码中,我面临的问题是(error:document has没有页面)请任何人帮助我解决这个问题
in this above code im facing a problem that (error:document has no page)plz any one help me hw to solve this problem


这篇关于如何用pdf进行设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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