Reputation: 2433
I have a JSF application which display dynamically generated images perfectly developed after going through this answer using primefaces. When I want to print a part of the web page which contain the images using p:printer, all the content of the selected segment is printed except the dynamically generated images.Images are represented by a very small icon.
I have tried the suggestions in the following links, but failed.
It is essential for the app to print dynamic image, please help.
Upvotes: 0
Views: 3244
Reputation: 2433
I used css to hide all other divs during print time and used window.print command.
Print button
<p:commandButton styleClass="noPrintBlock" ajax="false" value="Print" onclick="window.print();" actionListener="#{patientReportController.markAsPrinted()}" />
The component which I want to print.
<p:panel styleClass="printBlock" id="divPrint" >
</p:panel>
Example of a component which I do not want to print
<h:panelGroup styleClass="noPrintBlock">
</h:panelGroup>
CSS
@media print{
.noPrintBlock{
display: none;
}
.printBlock{
height: 100%;
width: 100%;
position: fixed;
top: 0;
left: 0;
margin: 0;
}
}
Upvotes: 1