技术开发 频道

asp.net2.0导出pdf文件完美解决方案

  4.前台代码:

<%...@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>清清月儿 制作导出PDF http://blog.csdn.net/21aspnet</title>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
        
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="导出" /></div>
    
</form>
</body>
</html>

  
  5.前台操作:


  6.属性说明:

  itextsharp-4.0.3-dll.zip   示例文件包含几乎所有的PDF处理需求

  颜色:

Font fontChinese = new Font(bfChinese, 12, Font.NORMAL,new Color(0, 0, 0)); //黑Font fontChinese = new Font(bfChinese, 12, Font.NORMAL,new Color(0, 255, 0)); //绿


  注释:
 
  iText支持不同风格的注释。

  u 文本注释:

  你可以添加一小段文本到你的文档中,但它并非文档内容的一部分,注释有标题和内容: 

Annotation a = new Annotation( "authors", "Maybe it's because I wanted to be an author myself that I wrote iText.");

 

  对齐方式:

  cell.HorizontalAlignment = Element.ALIGN_CENTER;
  cell.VerticalAlignment
= Element.ALIGN_MIDDLE;

  下划线/删除线:

Chunk chunk1 = new Chunk("This text is underlined",FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE));
  Chunk chunk2
= new Chunk("This font is of type ITALIC | STRIKETHRU", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.ITALIC | Font.STRIKETHRU));

  加密:

public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions);
0
相关文章