I've created a list button to generate CV for multiple selected records on list view. What should I do to have separate pdfs in one tab ?
So for example when I select 3 contacts I would like to have 3 pdfs for each contact. Now when I select 3 contacts I have one pdf.
This is my VF code:
<apex:page standardController="Contact" recordSetVar="contacts" extensions="GenerateResourceCv" renderAs="pdf">
<!-- <apex:form -->
<table cellpadding="4" cellspacing="0" width="100%" class="noBorder">
<tr class="noBorder">
<td class="heading noBorder" width="50%"><h2>Resource CV</h2></td>
</tr>
</table>
<h2 class="objectLabel">Contact Detail</h2>
<table cellpadding="4" cellspacing="0" width="100%" border="1">
<tr><td style="font-weight:bold;font-size:16px;" colspan="4">Contact Detail</td></tr>
<apex:repeat value="{!contacts}" var="contact">
<tr>
<td class="dataLabel" width="20%">Name</td>
<td class="dataValue" width="100%">{!contact.Name}</td>
<tr>
<td class="dataLabel" width="20%">Phone</td>
<td class="dataValue" width="100%">{!contact.Phone}</td>
</tr>
<tr>
<td class="dataLabel" width="20%">Email</td>
<td class="dataValue" width="100%">{!contact.Email}</td>
</tr>
<tr>
<td class="dataLabel" width="20%">Address</td>
<td class="dataValue" width="100%">
{!contact.MailingStreet}
{!contact.MailingCity}<br/>
{!contact.MailingState}<br/>
{!contact.MailingPostalCode}<br/>
{!contact.MailingCountry}
</td>
</tr>
</tr>
</apex:repeat>
</table>
<!-- </apex:form>-->
</apex:page>
Controller:
public class GenerateResourceCv {
ApexPages.StandardSetController setCon;
public final Contact contact;
public GenerateResourceCv(ApexPages.StandardSetController controller){
setCon = controller;
Set<Id> contactIdSet = new Set<Id>();
for (Contact contact :(Contact[])setCon.getSelected()){
contactIdSet.add(contact.Id);
}
}
public Contact getContact(){
return contact;
}
}