问题描述
我正在一个网站上工作,用户在其中输入名称,然后按一个按钮,提示服务器根据提供的信息创建pdf文件,然后将文件发送给用户.
我正在使用没有IIS的笔记本电脑测试网站.
我需要将pdf转换为希伯来语,并且找不到在希伯来语上带有vb的pdfwrite.相反,我创建了一个MS Word文档,然后使用下面的代码将其转换为pdf.
这在Firefox,Chrome和Safari上可以正常工作,但是在Internet Explorer上,下载前页面会断开连接.当执行创建单词语句时,它将断开连接.
谁能帮我吗?
I''m working on a website in which a user enters a name and then presses a button that prompts the server to create a pdf file according to the information provided, and then sends the file to the user.
I''m testing the website on my laptop without IIS.
I needed the pdf to be hebrew and couldn''t find a pdfwrite with vb on hebrew; instead, I create a MS Word document and then convert it to pdf using the code below.
This works fine on Firefox, Chrome, and Safari, but on Internet Explorer the page disconnects before the download. It disconnects when the create word statement is executed.
Can anyone help me?
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim strname As String
strname = TextBox1.Text.Trim
Dim oword As New word.Application
Dim odoc As New word.Document
oword = CreateObject("word.Application")
odoc = oword.Documents.Add("C:\documents\tamp.dotx")
odoc.Bookmarks.Item("name1").Range.Text = strname
odoc.Bookmarks.Item("name2").Range.Text = strname
odoc.Bookmarks.Item("name3").Range.Text = strname
odoc.Bookmarks.Item("name4").Range.Text = strname
odoc.Bookmarks.Item("name5").Range.Text = strname
odoc.Bookmarks.Item("name6").Range.Text = strname
odoc.ExportAsFixedFormat(Server.MapPath("\neshume.pdf"), 17)
Response.Redirect(Server.MapPath("\neshume.pdf"))
end sub
推荐答案
<div >
<iframe id="IFrame1" runat="server" frameborder="1" height="500" scrolling="auto" width="100%" >
<p>&nsbp;</p>
</iframe>
</div>
在.cs中创建以下功能:-
私人void PdfFile(string FileNameWithPath)
{
IFrame1.Attributes ["src"] = FileNameWithPath;
}
in .cs create following function:-
private void PdfFile(string FileNameWithPath)
{
IFrame1.Attributes["src"] = FileNameWithPath;
}
这篇关于无法使用Internet Explorer下载pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!