如何在C#后面的代码中打开新标签/窗口中特定部分的pdf [英] How to open pdf at particular section in new tab/window from code behind in C#

查看:72
本文介绍了如何在C#后面的代码中打开新标签/窗口中特定部分的pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在开发一个Web应用程序,在某个屏幕上我有一个帮助图标。我需要做的就是当用户点击帮助图标时,帮助文档的pdf文件将在新标签/窗口中打开,而这个pdf应该在特定部分打开(即不应该从第1页打开)。请帮帮我实现这个目标。

这是我的代码:



Hi all, I am working on a web application, in which I have a help icon on some screen. All i need to do is when user click on a help icon, a pdf file of help document will open in new tab/window and this pdf should open at a particular section (i.e. should not open from page 1). Please help me out to achieve this.
Here is my code:

protected void registrationHelpIcon_ServerClick(object sender, EventArgs e)
{
    try
    {
        string appBaseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";
        string pdfPath = "Temp/xtLytics_security_module.pdf";
        WebClient client = new WebClient();
        Byte[] buffer = client.DownloadData(appBaseUrl + pdfPath);
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", buffer.Length.ToString());
        Response.BinaryWrite(buffer);
    }
    catch(Exception ex)
    {
        Logger.Log(LogLevel.SystemError, ex);
    }
}





我的尝试:



我从代码项目中尝试了很多东西,但无法实现目标。请帮助我在特定部分打开的新选项卡或窗口中获取此pdf。



What I have tried:

I have tried many things from code project but unable to achieve the goal. Please help me out to get this pdf in new tab or window opened at particular section.

推荐答案

Adob​​e允许URL参数。



查看以下文档了解更多信息:



http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf [ ^ ]
Adobe allows URL parameters.

Review the following documentation for more:

http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf[^]


这篇关于如何在C#后面的代码中打开新标签/窗口中特定部分的pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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