Visualforce Page Code Examples
Object Detail Page
The following code snippet is an example of how to display a canvas app on an Account page. The code specifies the size of the canvas app to be 400 pixels high and 750 pixels wide. This examples specifies the canvas app using the applicationName and namespacePrefix.
<apex:page standardController="Account">
<apex:canvasApp applicationName="Test Inline Visualforce"
namespacePrefix="testorg"
height="400px" width="750px"/>
</apex:page>
Standard Page
The following code snippet is an example of how to display a canvas app on a Visualforce page. The code specifies the size of the canvas app to be 1,000 pixels high and 800 pixels wide. In addition, the code passes three custom parameters to the canvas app. This examples specifies the canvas app using the developerName and namespacePrefix.
<apex:page>
<apex:canvasApp developerName="Test_Standard_Visualforce"
namespacePrefix="testorg" height="1000px" width="800px"
parameters='{"p1":"value1", "p2":"value2", "p3":"value3"}'/>
</apex:page>
Standard Page with a Border and Scrolling
The following code snippet is an example of how to display a canvas app with some additional UI enhancements on a Visualforce page. The code specifies the size of the canvas app to be 100 pixels high and 500 pixels wide. In addition, the code specifies that there should be a border of 2 pixels around the canvas app and that scrolling should be enabled. This examples specifies the canvas app using only the applicationName (this is only valid in the organization in which the canvas app was created, and if that organization doesn’t have a namespacePrefix.
<apex:page>
<apex:canvasApp applicationName="Test Scrolling Visualforce"
height="100px" width="500px"
border="2" scrolling="yes"/>
</apex:page>