function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Technossus DeveloperTechnossus Developer 

Control Should not be loss after PDF page creation

Hi all,

 

As usual I am here with a new  issue...  I was just  thinking can we  generate the PDF by Apex code, no doubt we Can an I got the success and able redirect my page to anothet page whic is PDF,, but the problem is after generation of PDF we lost the controle to the salesforce UI, means no  tab, no address bar, no left pane menu nothing we got just whole PDF  only like that.. So I want to know is there any way so that I will redirect to another page as PDF but controle should not be loss as any normal VF page shows...  

 

Regards

Raman

bob_buzzardbob_buzzard

The problem here is that you redirect the user to a PDF page, and if the browser can it will render that using a PDF plugin or built in engine.  At that point, you have left the Salesforce UI behind.  One way to workaround this is to open the PDF in a new tab/popup window, such that the user can still go back.  Another would be to display the PDF inside an iframe on a VF page, and the VF page could still display the sidebar and header.

Technossus DeveloperTechnossus Developer

Thanks for the reply Bob ! The idea of display the PDF inside an iframe on a VF page sounds good

 

Can You tell me indetail how to do this thing ????

 

Regards

Raman

bob_buzzardbob_buzzard

Inside your VF page you'd have something like:

 

<apex:iframe src="/apex/MyFrame?param1=<param>"/>

replace MyFrame with the name of your VF page that is rendered as a pdf, and include any parameters required for it to render properly.

liron169liron169
Hello,

You can open the page in another tab/window.

If, for example, you click a button to open the PDF, you can use:

<apex:commandLink value="Open PDF" action="{!openPDF}" target="_new">