【问题标题】:Acrobat Opening in Full Screen ModeAcrobat 以全屏模式打开
【发布时间】:2010-01-27 20:38:41
【问题描述】:

我在 asp.net 的 iframe 中显示 PDF 时遇到问题。当 pdf 显示出来时,它没有显示允许用户缩放和打印的 Acrobat 工具栏。这给我们的客户带来了很大的麻烦,因为他们无法阅读其大小的 PDF。如果您尝试将 Acrobat 设置为不在浏览器中显示 PDF 并浏览到该页面,您会收到一条消息,指出它正在尝试以全屏模式打开它。有什么想法可以使它不从代码中执行此操作吗?下面是我用来将 PDF 流式传输到浏览器的代码:

Public Shared Sub StreamPdfToBrowser(ByVal doc As Document)
    Dim Ctx As HttpContext = HttpContext.Current
    '// Clear any part of this page that might have already been buffered for output.
    Ctx.Response.Clear()
    Ctx.Response.ClearHeaders()

    '// Tell the browser this is a PDF document so it will use an appropriate viewer.
    Ctx.Response.ContentType = doc.DisplayFileType

    Ctx.Response.ContentType = "application/pdf"
    Ctx.Response.AddHeader("content-type", "application/pdf")

    '// IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always.
    '// this makes a new window appear: 
    Response.AddHeader("content-disposition","attachment[inline]; filename=MyPDF.PDF");
    Ctx.Response.AddHeader("Content-Length", doc.DisplayFile.Length)
    Ctx.Response.AddHeader("Content-Disposition", "inline; filename=E-Sign Specification Report.pdf")

    '// TODO:  Added by KN to possibly fix UA issue
    Ctx.Response.ContentType = "application/pdf"
    Ctx.Response.AddHeader("content-type", "application/pdf")

    '// Write the PDF stream out
    Ctx.Response.BinaryWrite(doc.DisplayFile)

    '// Send all buffered content to the client
    Ctx.Response.End()
End Sub

【问题讨论】:

    标签: c# .net asp.net vb.net acrobat


    【解决方案1】:

    在 Adob​​e Acrobat 中启动 PDF,转到文件、属性并单击初始视图选项卡。在这里您可以设置人们打开此特定 PDF 时的默认视图,听起来像是选中了“以全屏模式打开”。

    【讨论】:

    • 我尝试在生成 PDF 选项时将其设置为不使用全屏模式,但并没有改变一切。无论如何从 Response.Write 中强制使用此选项?
    • 创建 PDF 后,在 Acrobat 中打开它。是否选中了全屏选项?
    • 我没有完整版的 Acrobat,所以看不到。你能在 Acrobat Reader 中看到这个吗?
    猜你喜欢
    • 2016-02-15
    • 1970-01-01
    • 2012-03-21
    • 2023-03-31
    • 2016-07-16
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多