悬赏园豆:10
[已关闭问题]
关闭于 2011-01-10 09:15
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">这是帮助文档中的一个例子,但是我却尝试不成功!报下面的错误</span></p>
<p><span>
<h2><em>Unsupported font name: AdobeSongStd-Light.: v5.0.0.1</em></h2>
</span>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">using</span><span style="font-size: 8pt; font-family: 'Courier New';"> System;</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">using</span><span style="font-size: 8pt; font-family: 'Courier New';"> Aspose.Pdf.Kit;</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">namespace</span><span style="font-size: 8pt; font-family: 'Courier New';"> formTest</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';">{</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">public</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">class</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008080; font-family: 'Courier New';">Class1</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> {</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> [</span><span style="font-size: 8pt; color: #008080; font-family: 'Courier New';">STAThread</span><span style="font-size: 8pt; font-family: 'Courier New';">]</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">public</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">static</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">void</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; font-family: 'Courier New';">Main</span><span style="font-size: 8pt; font-family: 'Courier New';">(</span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">string</span><span style="font-size: 8pt; font-family: 'Courier New';">[] args)</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> {</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//license As New Aspose.Pdf.Form.License</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008080; font-family: 'Courier New';">License</span><span style="font-size: 8pt; font-family: 'Courier New';"> license = </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">new</span><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008080; font-family: 'Courier New';">License</span><span style="font-size: 8pt; font-family: 'Courier New';">();</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Make sure that the license file's direcotry and name is right.</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> license.SetLicense(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">@"E:\work\form\VbTest\Aspose.Pdf.Form.lic"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//First an input and output pdf file should be assigned and</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//make sure that the files' direcotry and name is right.</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> Form form = </span><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">new</span><span style="font-size: 8pt; font-family: 'Courier New';"> Form(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"student.pdf"</span><span style="font-size: 8pt; font-family: 'Courier New';">, </span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"output.pdf"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Fill the field "Name" with "Mike".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Name"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Mike"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Choose the field "Gender" with "Male".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Gender"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Male"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Fill the field "Telephone".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Telephone"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"888.277.6734"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Fill the field "Address".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Address"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">Suite 163,79 Longueville Road, Lane Cove,NSW, 2066 </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">Australia</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Choose the item "GradeTwo" of the Combo field "Grade".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Grade"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"GradeTwo"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//use case for checking the checkbox "Lodging".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//form.FillField("Lodging","Yes");</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//use case for unchecking the checkbox "Lodging".</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Lodging"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Off"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span><span style="font-size: 8pt; color: #008000; font-family: 'Courier New';">//Fill the image button field.</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.FillImageField(</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"Photo"</span><span style="font-size: 8pt; font-family: 'Courier New';">,</span><span style="font-size: 8pt; color: #800000; font-family: 'Courier New';">"lovely.jpg"</span><span style="font-size: 8pt; font-family: 'Courier New';">);</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> form.Save(); </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> </span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> }</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';"> }</span></p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; font-family: 'Courier New';">}</span></p>
</p>
<p style="margin: 0pt; background-color: #d9d9d9;"><span style="font-size: 8pt; color: #0000ff; font-family: 'Courier New';">谁运行成功了,分享一下啊,谢谢</span></p>
问题补充:
问题已解决。这个例子没有问题。我之前没有运行出来,是因为 Form form = new Form("student.pdf", "output.pdf");
,这里面是两个参数,一个是读取的pdf,一个是输出的pdf。我只有一个参数。所以,运行失败