You need to sign in to do that
Don't have an account?
david boukhors 23
Visualforce page in console mode: only first page is printed
Hello,
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 {
font-size:10px;
color:red;
}
table {
border-collapse: collapse;
border-radius:30px;
}
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;
}
</style>
<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:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection id="assetList">
<apex:outputPanel >
<apex:repeat value="{!lAsset}" var="ass">
<table>
<tr>
<th colspan="2">Date</th>
<th>Scan to Call Customer</th>
<th>{!$ObjectType.Asset.fields.Address__c.Label}</th>
<th>Customer Informations</th>
<th>SF Unit ID</th>
</tr>
<tr>
<td colspan = "2">{!ass.Installation_Preferred_Date__c} </td>
<td colspan="1"><apex:image value="{!ass.Contact_QR__c}" height="110"/></td>
<td>{!ass.Address__c}<br/>
<b>{!ass.City__c}</b><br/>
{!ass.Postal_Code__c}<br/>
{!ass.Country__c}<br/>
</td>
<td>{!ass.Contact.Name}<br/>
{!ass.Contact.MobilePhone}<br/>
{!ass.Note__c}
</td>
<td><apex:image value="{!ass.AssetName_QR__c}" height="110"/><br/>
{!ass.Name}</td>
</tr>
</table>
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
</apex:repeat>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:form>
</apex:pageblock>
</apex:page>
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));
queryData(startDate,endDate);
}
@testVisible
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
David
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 {
font-size:10px;
color:red;
}
table {
border-collapse: collapse;
border-radius:30px;
}
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;
}
</style>
<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:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection id="assetList">
<apex:outputPanel >
<apex:repeat value="{!lAsset}" var="ass">
<table>
<tr>
<th colspan="2">Date</th>
<th>Scan to Call Customer</th>
<th>{!$ObjectType.Asset.fields.Address__c.Label}</th>
<th>Customer Informations</th>
<th>SF Unit ID</th>
</tr>
<tr>
<td colspan = "2">{!ass.Installation_Preferred_Date__c} </td>
<td colspan="1"><apex:image value="{!ass.Contact_QR__c}" height="110"/></td>
<td>{!ass.Address__c}<br/>
<b>{!ass.City__c}</b><br/>
{!ass.Postal_Code__c}<br/>
{!ass.Country__c}<br/>
</td>
<td>{!ass.Contact.Name}<br/>
{!ass.Contact.MobilePhone}<br/>
{!ass.Note__c}
</td>
<td><apex:image value="{!ass.AssetName_QR__c}" height="110"/><br/>
{!ass.Name}</td>
</tr>
</table>
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
</apex:repeat>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:form>
</apex:pageblock>
</apex:page>
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));
queryData(startDate,endDate);
}
@testVisible
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
David
<apex:outputPanel >
<apex:commandLink value="Print" onclick="window.print();" style="font-weight: bold;"/>
</apex:outputPanel>