Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
--------------------------------------

But showing error unable to save to Disk...at ----theDoc.Save("Test.pd")


Plz help...


Thnx
Posted
Updated 30-Jun-13 23:52pm
v2

1 solution

Hi,

Try this one, In this solution, you can use "PdfStamper" to Save the file, instead of using any other method.
C#
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()


Note:

In above your Code you didn't specified valid path.

Regards
sarva
 
Share this answer
 
v2
Comments
Aman.Jen 1-Jul-13 6:23am    
Thnxxx Bro Working Now....you are right path was not correct..:).....And is this PdfStamper is free verison...?
Sarrrva 1-Jul-13 6:34am    
please visit this link, you can get more information about this topic.
http://www.codeproject.com/Articles/23112/Fill-in-PDF-Form-Fields-using-the-Open-Source-iTex

if this answer is really helpful please accept as answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900