1

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')}">
...
</apex:page>

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? – Phil Hawthorn Jan 22 '15 at 8:15
1

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

0

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.

PS - Please accept the answer if it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.