Open with target=“_blank”?

2019-08-02 12:34发布

I am using RazorPdf to generate a .pdf document from one of my controller actions. All works well, except that in my generated .pdf, I have an embedded anchor that opens yet another .pdf, that resides on the web site.

Currently, if the user clicks the anchor, the referenced .pdf opens in the same browser window. I don't want this behavior. I want anchor to open in a new browser tab (e.g. target="_blank"), but can't see any way to accomplish this. Here's my anchor in my view:

<!-- Note: target="_blank" does not work //-->
<anchor target="_blank" font="underline" name="top" reference="http://www.example.com/Downloads/Attachment.pdf">Click Here</anchor>

标签: razorpdf
1条回答
ら.Afraid
2楼-- · 2019-08-02 13:10

You could add some jquery function and call it on the click of the anchor tag

jquery function something like

$("#OpenAttachment").click(function (e) {

        var actionUrl = '/Downloads/Attachment.pdf';
        window.open(actionUrl, '', 'width=1000,height=800');
    });

This will open a new browser window. Hope this helps :)

查看更多
登录 后发表回答