How to print a image file in printer

前端 未结 3 783
傲寒
傲寒 2021-01-27 12:53

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

3条回答
  •  梦如初夏
    2021-01-27 13:22

    You will receive image id using both h:form and h:graphicImage tag id's

    The Java script is :

     function printImage()         
     {            
       var iamgeId = document.getElementById('fileViewerForm:imageViewer');
    
       var imagObject = new Image();
       imagObject = iamgeId;
       var originalImage = '';
    
       popup =  window.open('','popup','toolbar=no,menubar=no,width=200,height=150');
       popup.document.open();
       popup.document.write("");
       popup.document.write(originalImage);
       popup.document.write("");
       popup.document.close();           
    }
    

    JSF code is :

      

    It works on FireFox 3.0.18.

    By,
    Eswara Moorthy, NEC.

提交回复
热议问题