How to print Visualforce page without header and footer int eh Print preview?

Sample Code:

Visualforce page:

<apex:page controller="Sample" showHeader="false">
<style type="text/css">

        size: auto A4 landscape;
        margin: 3mm;

<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listAcct}" var="a">
            <apex:column value="{!a.Id}"/>
            <apex:column value="{!a.Name}"/>
        <apex:pageBlockButtons >
            <apex:commandButton value="Print" onclick="window.print()"/>

Apex Class:

public class Sample {
    public List < Account > listAcct {get;set;}
    public Sample() {
        listAcct = [ SELECT Id, Name FROM Account ];


No comments:

Post a Comment