如何在新选项卡上打开.pdf [英] How to Open .pdf on a new Tab

查看:126
本文介绍了如何在新选项卡上打开.pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:

某些任务正确完成后,我必须在新选项卡上打印PDF.

I have to print a PDF on a new tab after some tasks have finished correctly.

步骤:我想执行一个应转到服务器的方法,获取PDF并在新选项卡上打开它,我正在尝试使用这些方法,但不起作用:

Steps: I want to execute a method that should go to the server, take the PDF and open it on a new Tab, I was trying with these but is not working:

控制器:导出

 public ActionResult PrintPdf()
    {
        Response.AppendHeader("Content-Disposition", "inline; filename= " + MyClassPdfWriter.GetFileName);
        return File(MyClassPdfWriter.GetMemoryStream, "application/pdf");
    }

查看:

function TasksSucced(){
      $.get('@Url.Action("PrintPdf", "Export", "new {target = _blank}")');
}

推荐答案

已解决!对我有用

 window.open('/Export/PrintPdf');

这篇关于如何在新选项卡上打开.pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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