如何在浏览器和电子邮件中打开pdf文件? [英] how can pdf file open in browser and email ?

查看:251
本文介绍了如何在浏览器和电子邮件中打开pdf文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dea all



我制作了一个项目,我在其中创建一个pdf文件并将其保存在同一位置,然后尝试打开它但不是打开请看下面的代码

如何打开文件



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

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()

推荐答案

PDF is不属于W3标准的一部分。尽管PDF通常由许多浏览器打开,但这不是标准操作;它通常通过浏览器插件实现,可以安装也可以不安装。如果您提供了一些PDF内容,则不应该假设该用户有任何PDF查看器。这完全没问题。首先,大多数用户都可以在浏览器中查看它们,如果没有,浏览器会建议在某个默认查看器中查看内容或在文件中保护它的替代方法。在这两种情况下,内容都将保存在文件中。如果根本没有安装PDF查看器,这仍然没问题,因为用户可以保存文件并稍后关注查看器;免费的观众随时可用。



或者,如果由于某种原因,你想在所有情况下在浏览器中显示PDF,你需要将某些PDF内容编码为HTML。我不建议打扰它,因为这些类型的文件之间没有一对一的对应关系;目的非常不同。 PDF是一种完全严格的格式,具有固定的布局,一种电子纸。相比之下,HTML流畅而灵活。



-SA
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


这篇关于如何在浏览器和电子邮件中打开pdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆