I have a Visualforce Page, that renders as PDF - conditionally. So from one button it shows as simple Visualforce page, and from another button (somewhere else in the app) it renders it as PDF. The markup of the page is something like:

<apex:page controller="clsReportData" showheader="false" sidebar="false" standardStylesheets="false" renderAs="{!IF(ISNULL($CurrentPage.parameters.pdf),'','pdf')}">

Now if I open the page without "pdf" parameter it displays fine, but if I append PDF parameter to page url it throws a "Time Limit Exceeded" error message. The Time limit is solely VF limit becuase the Debug Logs shows that APEX part of the Queries and data fetch completes well within 2~3 seconds max, calculated this via init Constructor Start time and constructor Call Finished Time, which shows that all data is fetched in 2 or 3 seconds. But the PDF is not rendered at all and it takes over 10 seconds and then it times out.

So, how can I fix this page? If my data query is not taking 10 seconds then why is it that the page is not rendered in PDF.

To shed more lights, the data that is being displayed on PDF and Visualforce is exactly same, and it shows 4 tables with one row each.

  • Is the exception coming from your browser or the platform do you know? i.e. is it a limits exception? Jan 22, 2015 at 8:15

3 Answers 3


Are you using the Visualforce component in page i.e apex:outputfield, apex:pageblocktable etc, if yes then replace with simple html tag.


Generally it happens that VF page rendering take more time then the apex execution since while rendering lot of things need to be considered like apply styling, executing JS code onload, loading static resources etc. Try to debug it further by removing all the styling and static resources from page and see if it loads without any issue. Then step by step apply styling, loading images and see what is causing the issue. These all applicable only if its platform time out exception not the browser one.


Check the page's API version. In my case, the apex code took about 1 sec of CPU time, and the generating of the PDF itself took almost 18 seconds. I found out that it uses an old api version (27). i updated it to 48 and it solved the problem.

You must log in to answer this question.

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