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
Puneet Sharma 77Puneet Sharma 77 

Can we generate custom PDF in Salesforce Mobile App by clicking on custom button.

I am unable to generate custom PDF by clicking on custom button. Is there any way to do that, kinldy help.
aanojas lanceraanojas lancer
Yes, a custom PDF may be generated in the Salesforce Mobile App by clicking on a custom button. It based on your requirements and the Salesforce edition you are using, the specific implementation may differ. You can take the following general approach:
  1. Create a custom Visualforce page or Lightning component that creates the PDF depending on your specifications. This page/component should provide the functionality required to retrieve the data and prepare it for the PDF.
  2. Create a custom button: Create a custom button or link on the Salesforce object where you want the PDF creation capabilities (e.g., a custom object or a standard object). This button should be set to redirect to the Visualforce page or Lightning component that was developed in Step 1.
  3. Modify the page layout for the Salesforce object and place the custom button in the relevant region of the layout.
  4. Examine the functionality: Save your modifications and open the Salesforce Mobile App. Locate the custom button you applied to a Salesforce object record. When you click the button, you should be sent to the Visualforce page or Lightning component that will produce the custom PDF.
Puneet Sharma 77Puneet Sharma 77
I have done all this but i am not able to view pdf in mobile app, but it is working on web.
SubratSubrat (Salesforce Developers) 
Hello Puneet ,

Regarding your query I have came across a discussion which will help you to achieve your goal .

This discussion has a conrtroller and a VF page code that will help you ->

If this helps , please mark this as Best Answer.
Thank you.
Stephen StoelingaStephen Stoelinga

1. Create an Apex Class: You can write an Apex class to generate the custom PDF content based on the data you want to include. This Apex class can use the "renderAs" attribute to generate a PDF format of the page.

2. Visualforce Page: Create a Visualforce page that utilizes the Apex class you just created. This page will display the data you want to include in the custom PDF.

3. Custom Button: Add a custom button to the relevant Salesforce object (e.g., Account, Contact) layout. This custom button will be configured to call the Visualforce page you created.

4. URL Button: For Salesforce Mobile App, use a URL button type instead of a Visualforce button, as Visualforce pages are not supported directly in the mobile app. The URL button should point to the URL of your Visualforce page with the relevant record ID parameter.

5. Page Layout: Make sure the custom button is added to the page layout of the Salesforce object so that it is visible and accessible.

6. PDF Generation: When users click the custom button in the mobile app, it will open the Visualforce page, generate the custom PDF content, and display it on the screen. Users can then use the built-in "Print" functionality on their mobile device to save the PDF or share it as needed.

Keep in mind that the above method may require some development skills and access to the Salesforce setup. Also, the Salesforce Mobile App's capabilities may have evolved since my last update, so I recommend checking Salesforce's official documentation or community forums for any new features related to PDF generation on the mobile app.

If you encounter any specific issues or need further assistance, you may want to consult with a Salesforce developer or administrator who can help you implement the custom PDF generation feature in the Salesforce Mobile App. (