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.