function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kitty SKitty S 

Is it possible to limit the results of a PDF page?

Hi. I am a complete coding novice so don't know if this is possible or not.

We have a custom object which returns voucher numbers, these can have an availability of Used, Available or Expired.  There is currently a custom button on the account page that produces a PDF of all the vouchers on that account.  I have been asked if we can limit this PDF to only show those vouchers with a status of Available.  Is this possible?

This is what the code looks like currently:
User-added image
Kitty SKitty S
Sorry, the image is really small!  This is the code:

<apex:page renderas="pdf" standardController="Account" >
<html>
    <body>
        <table cellspacing="1" cellpadding="1" border="0" width="570">
            <tbody>
                <tr>
                    <td>&nbsp;
<apex:image id="AAA_Publishing_Header" Value="https://cs87.salesforce.com/0158E000000DuWU"/>
 <apex:pageBlock title="Voucher Codes for {!account.name}">
 Please see below full details of your voucher codes. To redeem a voucher code just click it
<br/>
<br></br>
<br></br>
      <apex:pageBlockTable value="{!account.Open_Access_Tokens__r}" var="Tokens" border="2" cellspacing="2" cellpadding="2" columnsWidth="150">
                <apex:column headervalue="Voucher Code"> <apex:outputLink value="http://www.AAA.org/publishing/forms/application.asp?OpenAccess={!Tokens.Name}&Institution={!Account.Name}" id="Tokens">{!Tokens.Name}</apex:outputLink></apex:column>
         <apex:column headervalue="Type"> <apex:outputtext value="{!Tokens.Token_Type__r.Name}"></apex:outputtext></apex:column>
         <apex:column value="{!Tokens.Availability__c}"/>
         <apex:column value="{!Tokens.Espires_When__c}" headervalue="Valid Until"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
<apex:image id="AAA_Publishing_Footer" Value="https://c.eu3.content.force.com/servlet/servlet.ImageServer?id=01520000000pd1E&oid=00D20000000NwRI"/>  
</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
</apex:page>