You need to sign in to do that
Don't have an account?
Aneesh Allumalla
Passing values from one vf page to other as pdf
Hi,
My requirement is I have to create a simple vf page with one input field and one button. on clicking the button the value entered in the input field of the first page should be displayed in a pdf page.
Here is my code:
Controller:
public class PDFpage {
Public String x{get;set;}
Public String y{get;set;}
Public PDFpage(){}
Public pagereference submit(){
y=x;
PageReference pr = new PageReference('https://c.ap4.visual.force.com/apex/PDFpage2') ;
pr.setRedirect(true);
return pr;
}
}
VFpage1:
<apex:page controller="PDFpage" >
<apex:form >
<apex:pageblock >
<apex:pageBlockSection>
<apex:inputText label="Name" value="{!x}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:commandButton action="{!submit}" value="submit"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Vfpage2:
<apex:page controller="PDFpage" >
<apex:form >
<apex:pageblock >
<apex:pageBlockSection>
<apex:outputText value="{!y}"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
When I click the button after entering the value, it is creating an empty PDF without any value displaying in it.
Can anyone help how to get the value on to the PDF page.
My requirement is I have to create a simple vf page with one input field and one button. on clicking the button the value entered in the input field of the first page should be displayed in a pdf page.
Here is my code:
Controller:
public class PDFpage {
Public String x{get;set;}
Public String y{get;set;}
Public PDFpage(){}
Public pagereference submit(){
y=x;
PageReference pr = new PageReference('https://c.ap4.visual.force.com/apex/PDFpage2') ;
pr.setRedirect(true);
return pr;
}
}
VFpage1:
<apex:page controller="PDFpage" >
<apex:form >
<apex:pageblock >
<apex:pageBlockSection>
<apex:inputText label="Name" value="{!x}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:commandButton action="{!submit}" value="submit"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Vfpage2:
<apex:page controller="PDFpage" >
<apex:form >
<apex:pageblock >
<apex:pageBlockSection>
<apex:outputText value="{!y}"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
When I click the button after entering the value, it is creating an empty PDF without any value displaying in it.
Can anyone help how to get the value on to the PDF page.
This is solved here : https://developer.salesforce.com/forums/?id=9060G000000Xj73QAC
You would need a global class which exposes the logic as a webservice to generate the PDF and pass values to it.
Please mark it SOLVED if it helped you. Thanks!
Regards,
Krishna Avva
Option 1 : On the page load of the visualforce page, create an attachment and pass the Id to the second page ..
On a load of the second page you can able to get the attachment deils
Option 2 : - create a Rest API and Send the data between two pages
Opttion 3: Use SOAP API