vb.net应用程序的PDF代码 [英] PDF code for vb.net application
本文介绍了vb.net应用程序的PDF代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在我的网络应用程序中添加了一个第三方参考(WebSupergoo.ABCpdf),用于使用vb.net代码保存PDF文档。下面是相同的代码:
Hi,
I have added one third party reference(WebSupergoo.ABCpdf) to my web-application for saving PDF document using vb.net code . Below is the code for same:
Imports WebSupergoo.ABCpdf9
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 96
theDoc.AddText("Helo World of PDF")
theDoc.Save("Test.pdf")
theDoc.Clear()
End Sub
End Class
--------------------------------- -----
但显示错误无法保存到磁盘...在---- theDoc.Save(Test.pd)
Plz帮助...
Thnx
--------------------------------------
But showing error unable to save to Disk...at ----theDoc.Save("Test.pd")
Plz help...
Thnx
推荐答案
试试这个,在这个解决方案中,你可以使用PdfStamper保存文件,而不是使用任何其他方法。
Hi,
Try this one, In this solution, you can use "PdfStamper" to Save the file, instead of using any other method.
Dim FilePath As String = Server.MapPath("/docs/templates/page_1_cover.pdf")
Dim reader As New PdfReader(FilePath)
Dim newfile As FileStream
newfile = New FileStream(Server.MapPath("/docs/output/go.pdf"), FileMode.Create, FileAccess.Write)
Dim stamper As PdfStamper = New PdfStamper(reader, newfile)
stamper.AcroFields.SetField("APPLICANT NAME", "han")
reader.Close()
stamper.Close()
注意:
在您的上方您没有指定有效路径的代码。
问候
sarva
Note:
In above your Code you didn't specified valid path.
Regards
sarva
这篇关于vb.net应用程序的PDF代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文