PDF_Generation_and_Automation/force-app/main/default/pages/PdfProxyPage.page
2025-08-24 12:01:08 +05:30

44 lines
1.6 KiB
Plaintext

<apex:page controller="PdfProxyPageController" action="{!init}" showHeader="false" sidebar="false">
<apex:form id="proxyForm">
<apex:outputPanel id="resultPanel">
<apex:outputText value="{!result}" escape="false" />
</apex:outputPanel>
</apex:form>
<script>
// This will be called from the LWC
function makeHttpCall(endpoint, data) {
console.log('Making HTTP call to:', endpoint);
console.log('Data:', data);
// Use the Visualforce controller to make the HTTP call
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.PdfProxyPageController.makeHttpCall}',
endpoint,
JSON.stringify(data),
function(result, event) {
console.log('HTTP call result:', result);
if (result.success) {
// Send result back to parent LWC
window.parent.postMessage({
type: 'HTTP_RESPONSE',
success: true,
data: result.data
}, '*');
} else {
window.parent.postMessage({
type: 'HTTP_RESPONSE',
success: false,
error: result.error
}, '*');
}
},
{escape: false}
);
}
// Expose the function globally
window.makeHttpCall = makeHttpCall;
</script>
</apex:page>