<%@ CodePage="65001" %>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
<TITLE>AspPDF cjk Live Demo</TITLE>
</HEAD>
<BODY>
<TABLE WIDTH="640"><TR><TD>
<FONT FACE="Arial" SIZE="2">
<h3>AspPDF CJK Language Support Demo</h3>
<form action="demo_cjk.asp" METHOD="POST" NAME="MyForm">
Enter document title: <INPUT TYPE="TEXT"NAME="Title" SIZE="40" VALUE="<% = Request("Title") %>"><P>
Type or copy/paste some text in <B>Chinese/Japanese/Korean</B> (CJK) characters:<BR>
<textarea name="largetext" cols="80" rows="16"><% = Request("largetext") %>
</textarea><BR>
<INPUT TYPE="submit" name="Save" Value="Generate PDF">
</form>
<%
if Request("Save") <> "" Then
Set Pdf = Server.CreateObject("Persits.Pdf")
Set Doc = Pdf.CreateDocument
' Set title
Doc.Title = Request("Title")
Set page = Doc.Pages.Add
' Use an external file with the SimHei font supporting CJK alphabet
Set font = Doc.Fonts.LoadFromFile( Server.MapPath("simhei.ttf") )
Text = Request("largetext")
' Parameters: X, Y of upper-left corner of text box, Height, Width
Set param = pdf.CreateParam("x=100;y=742;height=692;width=412; spacing=2")
Do While Len(Text) > 0
CharsPrinted = Page.Canvas.DrawText(Text, param, font )
' We printed the entire string. Exit loop.
if CharsPrinted = Len(Text) Then Exit Do
' Otherwise print remaining text on next page
Set Page = Page.NextPage
Text = Right( Text, Len(Text) - CharsPrinted)
Loop
' We use Session ID for file names
' false means "do not overwrite"
' The method returns generated file name
Path = Server.MapPath( "files") & "\" & Session.SessionID & ".pdf"
FileName = Doc.Save( Path, false)
Response.Write "<P><B>Success. Your PDF file <font color=gray>" & FileName & "</font> can be downloaded <A HREF=""files/" & FileName & """><B>here</B></A></B>."
Set Page = Nothing
Set Doc = Nothing
Set Pdf = Nothing
End If
%>
<P>
<B><A HREF="demo_cjk.zip">Download source code (ASP and ASP.NET/C#) for this demo</A></B>
</FONT>
</TD></TR></TABLE>
</BODY>
</HTML>
该目录下放入 simhei.ttf 就可以实现中文的pdf文件