apex page:

<apex:page standardController="Opportunity__c" extensions="OpportunityController" renderAs="pdf">
      <apex:pageBlockSection title="Opportunities" collapsible="false">
        <apex:pageBlockTable value="{!opp}" var="op">
          <apex:column value="{!op.Name}"/> 
          <apex:column value="{!op.Parent_Account_Name__c}"/>
          <apex:column value="{!op.stage__c}"/>   
          <apex:column >
            <apex:commandLink value="Product Details" action="{!ProductDetails}">
              <apex:param name="recordId" value="{!op.id}"/>
      <apex:pageBlockSection title="Product List" collapsible="false">
        <apex:pageBlockTable value="{!prd}" var="p">
          <apex:column value="{!p.Name}"/>
          <apex:column value="{!p.Date__c}"/>
          <apex:column value="{!p.Discount__c}"/>
          <apex:column value="{!p.List_Price__c}"/>
          <apex:column value="{!p.Opportunity__c}"/>
          <apex:column value="{!p.Product_Code__c}"/>
          <apex:column value="{!p.Quantity__c}"/>
          <apex:column value="{!p.Sales_Price__c}"/>
          <apex:column value="{!p.SubTotal__c}"/>
          <apex:column value="{!p.Total_Price__c}"/>


public with sharing class OpportunityController {
  public List<Opportunity__c> opp {get;set;}
  public List<Product__c> prd {get;set;}

  public OpportunityController(ApexPages.StandardController controller) {
    opp=[select Name,Parent_Account_Name__c,stage__c from Opportunity__c ];

  public PageReference ProductDetails() {
    id custId=(Id) ApexPages.CurrentPage().getParameters().get('recordId');
    prd=[select id,Name,Date__c,Discount__c,List_Price__c,Opportunity__c,Product_Code__c,Quantity__c,Sales_Price__c,
    SubTotal__c,Total_Price__c from Product__c where Opportunity__c=:custId ];
    return null;

1 Answer 1


If you look at the documentation for <apex:commandLink>, you will see that the action parameter invokes a server method using AJAX. You can't use Javascript in a PDF. The <apex:outputLink> tag, on the other hand, simply uses a URL. If you want a link that works in a PDF, use the latter.

  • should i need to create java script for that link to be active in pdf?
    – user40980
    Jan 24, 2017 at 10:24
  • I'll repeat...you cannot use Javascript in pdf pages.
    – Adrian Larson
    Jan 24, 2017 at 11:20

You must log in to answer this question.

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