Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have a Visualforce page that I need to be paginated. I followed the guide at http://wiki.developerforce.com/page/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce and have verified that it generates the proper HTML. However, I cannot render the page as PDF because it references web resources that require authentication.

The HTML that Salesforce embeds into the iframe works as intended (I verified this by putting it into a simple HTML file and printing) but the encapsulating page breaks the pagination. Going by W3School's article on page-break I suspect it is styling on the outer CSS that is causing the trouble.

Is there anyway to get Salesforce to display a VF page directly, and not in an iframe? If not, what is the best way to solve this problem? Do I need to use JavaScript to just apply style="float:none;" recursively up the DOM?

share|improve this question
    
Do you want to page break for Printing? –  Phil Hawthorn Jan 4 '13 at 21:18
    
Yes, the page needs clean breaks without Accounts spanning multiple pages for printing purposes. –  Mike Chale Jan 4 '13 at 21:53
add comment

2 Answers 2

up vote 3 down vote accepted

If you have the development mode footer on then there will be an iframe involved.

<apex:page showHeader="false" sidebar="false">
     <h1>My Page</h1>
     <p>Here is some introductory information</p>
</apex:page>

That gets served by Salesforce to your browser in a page that contains the development mode footer framework in addition to the actual VF page and there's an iframe involved.

<iframe frameborder="0" id="contentPane" name="contentPane" 
   onload="initContentFrame('https://c.na14.visual.force.com/apex/testPage?core.apexpages.devmode.url=1', true, false);" 
   src="/blank.html" 
   style="width: 100%; height: 100%" 
   title="Content Pane"></iframe>

You can turn off the development mode footer either through your user profile or just clicking the "Disable Development Mode" icon which looks like a circle with an 'X' on the upper right corner of the footer. Then bring up your page again it will not contain an iframe, because the development mode footer / environment part will be gone.

I have implemented VF pdfs with the page-break-inside:avoid (different than what you are doing) without any issues, but I haven't attempted it in non pdf VF pages, and it looks like it wouldn't have worked for me because browser support is questionable, outside of opera.

share|improve this answer
    
Turned off Development Mode and it worked like a charm. –  Mike Chale Jan 7 '13 at 12:20
add comment

Where are you representing the VF page? Pages can be accessed directly via /apex/{PageName} without an iframe, if that is what you mean - and standardStyleSheets/headers to false should revert any existing CSS.

share|improve this answer
    
The page is launched from a Detail Button on a custom object's layout. I've tried having it open in the same window and a new window. –  Mike Chale Jan 4 '13 at 21:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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