Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:
Dea all

I Have Make A Project in which i am creating a file in pdf and save it same location and then try to open it but is is not open please see bellow code
how can i open file

VB
Dim nvc As New NameValueCollection
            nvc.Add("Contact ID", contactid)
            nvc.Add("First Name", txtfname.Text)
            nvc.Add("Last Name", txtlname.Text)
            nvc.Add("Address", txtaddress.Text)
            nvc.Add("APT", txtapt.Text)
            nvc.Add("Postal Code", txtpostalcod.Text)
            nvc.Add("City", txtcity.Text)
            nvc.Add("Province:", DropDownList1.Text)
            nvc.Add("Country:", DropDownList2.Text)
            nvc.Add("Phone:", txtphone.Text & vbNewLine & s)
            nvc.Add("E-mail:", txtemail.Text)
            nvc.Add("Campus of Interest:", DropDownList3.Text)
            nvc.Add("Program of Interest:", DropDownList4.Text)
            nvc.Add("How did you hear about us?:", DropDownList5.Text)
            nvc.Add("Campus of Interest:", DateTime.Now.ToString("f"))
            Dim path As String = (Server.MapPath("~\\Forms\"))
            Dim pdf As New PdfCreator
            pdf.Open(path)
            pdf.AddTitle(("Contact Form - " + DateTime.Now.ToString("f")))
            pdf.AddPanel("Contents", nvc)
            pdf.Close()
            'Response.Redirect("~\\2418073b-d153-4e12-941d-c97250b8e9dd.pdf")

            Response.Redirect(path + pdf.Filename)
            Response.Flush()
Posted
Comments
Sampath Lokuge 15-Mar-14 10:41am    
Is there any error or what ?

1 solution

PDF is not a part of W3 standards. Even though PDFs are usually opened by many browsers, this is not a standard operation; and it is often implemented via a browser plug-in which may or may not be installed. If you deliver some PDF content, you should never assume that the use has any PDF viewer. This is perfectly fine though. First of all, most users have the possibility to view them in browser, and if not, the browser will suggest an alternative to view the content in some default viewer or safe it in the file. In both cases, the content will be saved in the file. If no PDF viewers are installed at all, this is still fine, because the user can save the file and take care about a viewer later; the free-of-charge viewers are readily available.

Alternatively, if, by some reason, you want to show PDF in the browser in all cases, you would need to encode some PDF content as HTML. I would not advice to bother about it, because there is no on-to-one correspondence between those types of documents; there are very different in purpose. PDF is a totally rigid format with fixed layout, a kind of electronic paper. In contrast, HTML is fluid and flexible.

—SA
 
Share this 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