Newbie to salesforce so please excuse any errors or wrong syntax. Essentially we have a dirty workaround manual menu that allow users to download a PDF letter from command buttons.
At the moment the Apex controller has multiple PageReference classes that manually (hardcoded) references a VisualForce Page for every letter that needs converted to PDF. for example
public PageReference saveLetter1(){
//visualforce page to create PDF from
pageReference pdf = Page.ltr_one_generalexample;
I want to create a reusable class by simply passing the VF Page name as a string value in the command button and use it in the apex class, but cannot seem to grab the value (always null).
<apex:commandButton action="{!saveLetter1}" styleClass="btn-info btn-lg"
value="Download Letter">
<apex:param name="VPName" value="!ltr_ws_addbin_new_refusal" assignTo="
{!VPName}"/>
</apex:commandButton>
And in Apex class
public String VPName{get;set;}
//and use as
pageReference pdf = Page.VPName;
Can this be done and can a page reference use a string variable as indicated. If there is an easier way??