I need to generate PDF with a lot of data collected as user inputs saved in a custom object. I have created a dynamic VF page with renderAsPDF which generate the same on a button click. But there is high chance that the response size can get larger than 15 MB. Is there is any way I can accomplish this?

I have found some solutions for visualforce pages like pagination for lists, dynamic loading on scrolling etc. which can't be used as this is pdf to be generated


A medium term answer is to use Salesforce Functions that will provide tightly integrated access to an environment that does not have to the governor limit restrictions we normally have to live within. But not GA yet and no news at the moment on how it will be priced. Also leaves you needing to learn another stack/language.

You might be able to get jsPDF to do the work at the client-side if the data can be generated within the governor limits and is less than the 10,000 row limit of a read-only Visualforce page, though I've yet to find a working example of that.

But AFAIK there is no simple solution to this problem.

  • Hi Keith, Thanks for the answer. I am thinking of spliting the pdf into 2 if it will exceed the limit. Is there any way provided by salesforce to get the response size before generating the pdf inorder to implement the same? Nov 24 '20 at 9:00
  • @salesforcets I think you will just have to do some tests to establish the relationship between number of rows and pdf size then give yourself say a 20% margin. Not sure where the "official" documentation is but FYI several sizes involved.
    – Keith C
    Nov 24 '20 at 10:03

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .