如何给PDF文件加文字水印? 菜鸟请高手们指教指教!!!! 急 急 急 ! 分数不多但望指教!最好有代码. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 itextsharpAbcPdfhttp://www.codeproject.com/KB/cs/iTextSharpPdfTables.aspx 一楼给的是代码 Download iTextSharpPdfTables.zip - 198.3 KB 点击这个连接就可以下载 要注册CodeProject帐号的,~ 用ABCPDF收费组件或其他免费组件 这是给图片加水印的,看看是否能帮上你using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;using System.Drawing.Text;public partial class Default3 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { //设定需要添加水印图片的路径 Image1.ImageUrl = "image\\1.jpg"; } protected void Button1_Click(object sender, EventArgs e) { //设定被添加水印图片的服务器路径 string imagepath = Server.MapPath("image\\1.jpg"); //创建一个位图 Bitmap bitmap = new Bitmap(imagepath); //根据位图创建画布 Graphics g = Graphics.FromImage(bitmap); //设定图片显示的样式 g.SmoothingMode = SmoothingMode.AntiAlias; //在图片上添加文字,注意结合图片大小设置文字位置 g.DrawString(this.TextBox1.Text, new Font("黑体", 30, FontStyle.Bold), SystemBrushes.WindowText, new Point(300,200)); //设定图片类型 Response.ContentType = "Image/jpeg"; //设置图片保存路径 string savepath = Server.MapPath("image"); //保存图片 bitmap.Save(savepath + "\\" + "a1.jpg", ImageFormat.Jpeg); bitmap.Dispose(); g.Dispose(); this.Image1.ImageUrl = "image/" + "a1.jpg"; }} 客户端在调用WebService出现异常 问个窗口程序上的一小句 ZedGraph 控件 Y轴的问题 保存xml的问题。高手帮帮我啊! C# 不同窗体间的通信问题 C#小白 请教简单问题 【正则请教】 熟悉正则的弟弟或哥哥友情帮助一下,怎么解析下面这段数据? 应用池回收的诡异现象,求解 求指教,怎么在form窗体中可以选择上传图片并且显示为头像 请问什么叫正则表达式?它有什么作用?怎么写? 连接数据库,添加用户 Dev的 CheckedListBoxControl 获取有焦点的 选项的值
pAbcPdf
http://www.codeproject.com/KB/cs/iTextSharpPdfTables.aspx
要注册CodeProject帐号的,~
或其他免费组件
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//设定需要添加水印图片的路径
Image1.ImageUrl = "image\\1.jpg";
} protected void Button1_Click(object sender, EventArgs e)
{
//设定被添加水印图片的服务器路径
string imagepath = Server.MapPath("image\\1.jpg");
//创建一个位图
Bitmap bitmap = new Bitmap(imagepath);
//根据位图创建画布
Graphics g = Graphics.FromImage(bitmap);
//设定图片显示的样式
g.SmoothingMode = SmoothingMode.AntiAlias;
//在图片上添加文字,注意结合图片大小设置文字位置
g.DrawString(this.TextBox1.Text, new Font("黑体", 30, FontStyle.Bold), SystemBrushes.WindowText, new Point(300,200));
//设定图片类型
Response.ContentType = "Image/jpeg";
//设置图片保存路径
string savepath = Server.MapPath("image");
//保存图片
bitmap.Save(savepath + "\\" + "a1.jpg", ImageFormat.Jpeg);
bitmap.Dispose();
g.Dispose();
this.Image1.ImageUrl = "image/" + "a1.jpg";
}
}