You need to sign in to do that
Don't have an account?
Manu@dev
Unable to open link in new tab inside VF page when rendered as PDF
Hi all,
I am developing VF page using renderAs PDF. I am unable to open the link in new tab using target="_blank". Here is the code
<a href="https://www.google.co.in" class="myButton" target="_blank" style="text-align:center;padding:20px 20px 20px 20px">Send Email</a>
Can some help me to solve this issue.
R - Manu
I am developing VF page using renderAs PDF. I am unable to open the link in new tab using target="_blank". Here is the code
<a href="https://www.google.co.in" class="myButton" target="_blank" style="text-align:center;padding:20px 20px 20px 20px">Send Email</a>
Can some help me to solve this issue.
R - Manu
Try using apex command link with appropriate link and target="_blank"
Thanks,
Sagar.
I tried using apex command link and command button but it is not working.
R - Manu
Thanks.
Here is the full code. Are you able to open link in new tab with href in VF page rendered as PDF ? If yes, here is the full code.
<apex:page applyBodyTag="false" applyHtmlTag="false" standardStylesheets="true" showHeader="false" renderAs="PDF" cache="true">
<Style>
.myButton {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dbd7db), color-stop(1, #e0dde0));
background:-moz-linear-gradient(top, #dbd7db 5%, #e0dde0 100%);
background:-webkit-linear-gradient(top, #dbd7db 5%, #e0dde0 100%);
background:-o-linear-gradient(top, #dbd7db 5%, #e0dde0 100%);
background:-ms-linear-gradient(top, #dbd7db 5%, #e0dde0 100%);
background:linear-gradient(to bottom, #dbd7db 5%, #e0dde0 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dbd7db', endColorstr='#e0dde0',GradientType=0);
background-color:#dbd7db;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #050005;
display:inline-block;
cursor:pointer;
color:#000000;
font-family:arial;
font-size:15px;
font-weight:normal;
padding:6px 24px;
text-decoration:none;
}
.myButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e0dde0), color-stop(1, #dbd7db));
background:-moz-linear-gradient(top, #e0dde0 5%, #dbd7db 100%);
background:-webkit-linear-gradient(top, #e0dde0 5%, #dbd7db 100%);
background:-o-linear-gradient(top, #e0dde0 5%, #dbd7db 100%);
background:-ms-linear-gradient(top, #e0dde0 5%, #dbd7db 100%);
background:linear-gradient(to bottom, #e0dde0 5%, #dbd7db 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e0dde0', endColorstr='#dbd7db',GradientType=0);
background-color:#e0dde0;
}
.myButton:active {
position:relative;
top:1px;
}
</style>
<body>
<a href="https://www.google.co.in" class="myButton" target="_blank" style="text-align:center;padding:20px 20px 20px 20px">Send Email</a>
</body>
</apex:page>
R - Manu
Your Code is correct. PDF format is used to save the page in .pdf format in desktop for portability. It is not used for Online purpose or to open in browser.
Manu, My assumption is You want Hyper link in some other page, when the link is clicked the another visualforce should be rendered as PDF format. If this one means create two visualforce pages put link in one page, and rendered content in another page.
If you are not clear still, please tell me your requirement with more clear.
Thanks.
Arunkumar.R
Thanks for your replies and here is my complete requirement.
I have a custom object and I have created a custom button inside that object. Now custom button appears at of each and every record of that object. On click of that button the PDF is generated.
I have a VF Page rendered as PDF. Inside the PDF I should have a link/button which should send an email in XML format (The email body consists of that record details).
After generating PDF I am unable to use any command button/link actions to send the email. Nothing works here. So I have used href to redirect to another VF page(This page is not rendered as PDF) and there I have created a button to send one email. Now during this redirection, I want this new page to be reopened in new tab. Currently it is openining in same tab.
This is my complete requirement. Just redirecting from PDF to VF page should happen in new tab, is the one which is currently not working, instead it is opening in the same tab.
Thanks,
Manu