如题.
能将aspx的页面转换成PDF.
有例子.直接QQ22317984 联系. 附加信息:CSDN
如可以.
150分给出

解决方案 »

  1.   

    http://topic.csdn.net/u/20100427/15/d911f53b-b33e-4296-8f5a-a0f44a0e2bbe.html
    此帖40分累加给
      

  2.   

    研究研究Adobe的开发dll 试试
      

  3.   

    using System;   
      using System.Web;   
      using System.Web.UI.HtmlControls;   
      using System.Web.UI;   
      using System.Web.UI.WebControls;   
      using System.Web.UI.WebControls.WebParts;   
      using System.Collections.Generic;   
      using System.Text;   
      using System.IO;   
      using MacIntfc.CF.AppBase.Shr.ValueObject;   
      using MacIntfc.CF.Component.Web;   
      using MacIntfc.CF.AppBase.Shr.Exceptions;   
        
      using iTextSharp.text;   
      using iTextSharp.text.pdf;   
      using TRANSCOSMOS.DM.ValueObject;   
        
      namespace TRANSCOSMOS.DM.ValueObject   
      {   
      public class PDF_Print_Out   
      {   
        
        
      // * FONT
      private const string T_FONT = "textfont";   
        
      // the name of the Text in the Temp   
      // 普通だFont   
      private string[] FIED_NM_OHOR ={   
      "DMD_ADRSE_ZIP", "DMD_ADRSE_ADDR",   
      "CO_NM","DMD_ADRSE_POST_NM",   
      "DMD_ADRSE_MNGP_NM","DMD_ADRSE_CHRG_NM",   
      "BILL_NLT_DT","ORDER_CODE",   
      "DMD_DATE","APPLICATION_ID",   
      "PRT_ADDR_NM","ORG_NM",   
      "PRT_P_NO","PRT_F_NO",   
      "EIGYO_EMP_NM","SERVICE_START_DATE",   
      "SERVICE_END_DATE","PAY_METHOD",   
      "JYUTYU_KINGAKU","INSTALLMENT_COUNT",   
      "DMD_COUNT","MATTER_NAME",   
      "DMD_TOTAL","DETAIL_REMARKS_COLUMN",   
      "EMP_KJ_L_NM"   
      };   
        
      private HttpServerUtility Server = null;   
        
        
        
      // * TEMPLATE_NM   
      private String TEMPLATE_NM = null;   
        
      public PDF_Print_Out(HttpServerUtility server)   
      {   
      this.Server = server;   
      this.TEMPLATE_NM = Server.MapPath("~/pdf_out_prict.pdf");   
      }   
      /// <summary>   
      /// Create PDF File   
      /// </summary>   
      /// <param name="values"></param>   
      public void Creat_PDF_File(HttpResponse Response, string[] values)   
      {   
        
      this.createPDF_OHOR(Response, FIED_NM_OHOR, values);   
      }   
        
        
      private void createPDF_OHOR(HttpResponse Response, string[] FIELD_NM, string[] values)   
      {   
      PdfReader reader = null;   
      PdfStamper stamp = null;   
      Stream file = null;   
      string sname = DateTime.Now.ToString("yyMMddhhmmss");   
      Random Rand = new Random(4);   
      sname = sname + Convert.ToString(Rand.Next(100)) + ".pdf";   
      try   
      {   
      reader = new PdfReader(this.TEMPLATE_NM);   
        
        
      file = new FileStream(@"D:\" + sname, FileMode.OpenOrCreate);   
        
      stamp = new PdfStamper(reader, file);   
      BaseFont baseFont = this.getFont();   
      AcroFields form = stamp.AcroFields;   
      //cb = stamp.GetOverContent(1);   
        
      for (int i = 0; i < values.Length; i++)   
      {   
      form.SetFieldProperty(FIELD_NM[i], T_FONT, baseFont, null);   
      form.SetField(FIELD_NM[i], values[i]);   
      }   
        
        
        
      stamp.FormFlattening = true;   
      stamp.Close();   
      long FileSize;   
      FileStream PDFfile = new FileStream(@"D:\" + sname, FileMode.Open);   
        
      FileSize = PDFfile.Length;   
      byte[] buffer = new byte[(int)FileSize];   
      PDFfile.Read(buffer, 0, (int)FileSize);   
      PDFfile.Close();   
      //File.Delete(@"D:\WINSOR\PDF_OUT\PDF\PDF_OUT" + sname);   
      Response.AddHeader("Content-Disposition", "attachment");   
      Response.ContentType = "application/pdf";   
      Response.BinaryWrite(buffer);   
      Response.Flush();   
      Response.Close();   
        
        
      }   
      catch (Exception ex)   
      {   
      if (stamp != null)   
      {   
      stamp.Close();   
      }   
      throw ex;   
      }   
      finally   
      {   
      if (File.Exists(@"D:\" + sname))   
      {   
        
      File.Delete(@"D:\" + sname);   
      }   
      }   
        
        
      }   
        
      // 普通
        
      private BaseFont getFont()   
      {   
      BaseFont font = BaseFont.CreateFont(@"C:\WINDOWS\Fonts\msmincho.ttc",BaseFont.IDENTITY_H , BaseFont.EMBEDDED);   
      return font;   
      // Return the base font to create the pdf document   
      }   
        
      }   
      }   
      

  4.   

    有专门的的插件的,abcpdf也可以,不过这个要在服务器那装了软件才可以用。
    iTextSharp感觉一点都不实用,不能解析HTML标签,所有显示的格式都要自己来控制。
      

  5.   

    http://topic.csdn.net/u/20091031/10/9a66425e-d0a1-4dc2-953a-13f151fb2444.html