2

I have designed a solution to generate a document for each record with the values from the record by having button that will generate a PDF form of the record with selected fields and there values.

I have a question that is it possible to add button to the PDF rendered VF page where user can click it.

7
  • I am not sure about button, but I think it is possible for links -- developer.salesforce.com/forums/?id=906F0000000950ZIAQ. Just ensure to put full URL
    – kurunve
    Commented Feb 13, 2017 at 13:01
  • What should the button do? Can't use a link styled as button instead as @kurunve suggested?
    – mascot
    Commented Feb 13, 2017 at 13:26
  • @mascot the button functionality is to send mail to the customer Commented Feb 13, 2017 at 13:41
  • Your question is Can rendered VF page have buttons, now you are saying that you want to send email. Can you please explain your requirement in detail?
    – Saroj Bera
    Commented Feb 13, 2017 at 13:50
  • @SamuelRobert you can make that link of course, but to make it working, you need to have authorized user into appropriate salesforce org. I can not even imagine any single scenario when I want to send an email from PDF
    – kurunve
    Commented Feb 13, 2017 at 13:51

1 Answer 1

2

Yes, it is possible There is an example below, that shows couple of links (as link, as buttons and as custom URL field as link type)

    <apex:page standardController="Account" renderAs="pdf" 
               standardStylesheets="false" showHeader="false" 
               sidebar="false" applyBodyTag="false"  >
    <body>
        <div class="button">
            <a href="https://google.com">Some custom link</a>
        </div>
        <div>
            <a href="https://google.com" 
               style="font: bold 11px Arial;text-decoration: none; 
                      background-color: #EEEEEE;color: #333333;padding: 2px 6px 2px 6px;
                      border-top: 1px solid #CCCCCC;border-right: 1px solid #333333;
                      border-bottom: 1px solid #333333; 
                      border-left: 1px solid #CCCCCC;">
                 Some link like a button
            </a>
        </div>
        <apex:detail subject="{!Account.Id}" relatedList="false" inlineEdit="false" showChatter="false"  />
    </body>
</apex:page>

If render as pdf, can result as pdf shown below: enter image description here

All the links are clickable (at least in google chrome preview) and lead to appropriate page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .