How to print a image file in printer
Posted
by jackrobert
on Stack Overflow
See other posts from Stack Overflow
or by jackrobert
Published on 2010-04-30T03:37:21Z
Indexed on
2010/04/30
3:47 UTC
Read the original article
Hit count: 283
Hi, I write a simple program to print a image in JSF....
I have one image (sampleImage.png).. Already i connected my pc to printer....
Manually i open the image and select print option , then i got image from printer....
Now i want print image using javascript....
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Printer</title>
<script type="text/javascript">
function printImage()
{
// Here i want write a script for print image
}
</script>
<body>
<h:form id="fileViewerForm">
<rich:panel>
<f:facet name="header">
<h:outputText value="Printer"/>
</f:facet>
<h:commandButton value="PrintImage" onclick="printImage();"/>
<rich:panel id="imageViewerPanel">
<h:graphicImage id="imageViewer" url="sampleImage.png" </rich:panel>
</rich:panel>
</h:form>
</body>
</html>
help me about this..
© Stack Overflow or respective owner