I want to print one div with primefaces printer (primefaces 3.2 with myfaces 2.0).
My faces code is like:
<div id="page">
<!-- SIDEBAR -->
<div id="sidebar"
class="ui-widget-content ui-corner-all ui-helper-clearfix ui-shadow sidebar">
<ui:insert name="sidebar"></ui:insert>
<p:commandButton value="Print" type="button">
<p:printer target="content" />
</p:commandButton>
</div>
<!-- CONTENT -->
<div id="content">
<ui:insert name="content">...</ui:insert>
</div>
<div style="clear: both;"> </div>
</div>
But I get a FacesException:
javax.faces.FacesException: Cannot find component content in view.
Is this possible with primefaces printer or is there another way to do this.
Best Regards Veote
p:printerexpects an id of the component, butui:insertdefines a logical section which is going to be inserted by the client. You could try to wrap the content you wish to print inp:outputPanellike so: