http://www.jb51.net/dll/ABCpdf6.dll.html
ABCpdf.dll 下载这个dll放到bin文件夹里面
using WebSupergoo.ABCpdf6;
using System.Text.RegularExpressions;
using System.IO;
public void getPdf(string pdf, string name, string group)
{
Random r = new Random();
Doc theDoc = new Doc();
theDoc.TopDown = true;
theDoc.Rect.String = "40 50 990 1450";//控制显示的大小205 300 632 895
theDoc.MediaBox.String = "0 0 990 1500";//控制页面的大小
string reg = @"\<a id\=(.)+\</a\>";//这段正则主要是去掉页面中自己不需要显示的东西
string reg1 = @"body\{(.)+\}";
string temp =Regex.Replace(Regex.Replace(getHtml(pdf), reg1, ""), reg, "");
temp = temp.Replace("","");
int theID = theDoc.AddImageHtml(temp, true, 0, false);
while (true)
{
if (!theDoc.Chainable(theID))
{
break;
}
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
byte[] theData = theDoc.GetData();
FileCreate(name, theData);
if (File.Exists(HttpContext.Current.Server.MapPath("/uploads/pdfFile/" + name + ".pdf")))
{
Response.Redirect("/uploads/"+name+".pdf");
}
else
{
//对不起,文件未找到
}
}