+ Start a Discussion
david boukhors 23david boukhors 23 

Visualforce page in console mode: only first page is printed


I have a VF page:
<apex:page standardController="Asset" applyBodyTag="true"  showHeader="false" language="{!$CurrentPage.parameters.lang}" extensions="VFCTechnicianWorksheet" 
           docType="html-5.0" title="Technician Worksheet" sidebar="true">
    <style type="text/css" media="all">          
 .headerStyle {  
 table {
    border-collapse: collapse;
 table, th, td {
    border: 1px solid black;
th, td {
    padding: 15px;
    text-align: left;
    border:solid black 1px;
tr:nth-child(even) {background-color: #f2f2f2}
th {
    background-color: #4682B4;
    color: white;
    <apex:pageblock >
        <apex:form style="text-align:center;">
            <apex:pageBlockSection id="Main">
                <apex:outputPanel >
                    <apex:outputLabel >Select Period: </apex:outputLabel>
                    <apex:outputLabel >Start Date</apex:outputLabel><apex:input value="{!startDate}" type="date"/>
                    <apex:outputLabel >End Date</apex:outputLabel><apex:input value="{!endDate}" type="date" label="End Date"/>
                    <apex:commandButton action="{!filterData}" value="Apply Filter" id="filterButton" reRender="assetList,Main"/>
            <apex:pageBlockSection id="assetList">
                <apex:outputPanel >
                    <apex:repeat value="{!lAsset}" var="ass">
                                <th colspan="2">Date</th>
                                <th>Scan to Call Customer</th>
                                <th>Customer Informations</th>
                                <th>SF Unit ID</th>
                                    <td colspan = "2">{!ass.Installation_Preferred_Date__c} </td>
                                    <td colspan="1"><apex:image value="{!ass.Contact_QR__c}" height="110"/></td>
                                    <td><apex:image value="{!ass.AssetName_QR__c}" height="110"/><br/>

And a Controller:
public class VFCTechnicianWorksheet {
    @testVisible private Asset myAsset;
    @testVisible private PageReference p;
    public Date startDate {get;set;}
    public Date endDate {get;set;}
    @testVisible public List<Asset> lAsset {get;set;}
    public VFCTechnicianWorksheet(ApexPages.StandardController controller) {
        myAsset= (Asset) controller.getRecord();
        p = new Pagereference ('/'+myAsset.Id);

    public void filterData(){
        system.debug(String.valueOf(startDate) + String.valueOf(endDate));
    private void queryData(Date aStartDate,Date aEndDate){
        lAsset = [Select Id,Installation_Preferred_Date__c,
                  AssetName_QR__c,Contact_QR__c,Note__c ,Name,
                  Contact.Name,Contact.MobilePhone, Contact.Email,Address__c,City__c ,Postal_Code__c ,Country__c 
                  from Asset where InstallDate = Null and Installation_Preferred_Date__c > :aStartDate 
                  and Installation_Preferred_Date__c < :aEndDate order by Installation_Preferred_Date__c ASC];

When I display this VF page in a non console App, I can print pages without problem.
When this page is in a console mode App (as a VF Tab), I can scroll and see all the pages. But When I right click and select Print, I only see the first page. 
Does someone think there is a workaround to this?

Best Regards

Best Answer chosen by david boukhors 23
david boukhors 23david boukhors 23
Just added this js function in the page, and now it works fine.

<apex:outputPanel >
         <apex:commandLink value="Print" onclick="window.print();" style="font-weight: bold;"/>