我需要使用asp.net从客户端打印条码的确切大小 [英] I need to print the exact size of barcode from client side using asp.net

查看:151
本文介绍了我需要使用asp.net从客户端打印条码的确切大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从条形码打印机打印条形码,条形码标签的大小高度为2.5厘米。宽度是5厘米,来自客户端。

这里我的问题是,当我尝试自定义条形码的大小时,窗口大小是自定义而不是窗口中的文档中存在的条形码大小.print()。

我已经尝试了很多但是我不能,在下面的编码中我试图调整窗口中的文档大小但是当我单击打印按钮时窗口没有出现。 />


请帮助在窗口和窗口中显示确切的文档大小。让它打印条形码...



I want to print the barcode from barcode printer, the size of barcode label is 2.5cm in height & width is 5cm that is from client side.
Here my problem is, when ever I try to customize the size of the barcode, the window size is customizing not the barcode size that is present in document in windows.print().
I have tried a lot but I couldn't, here in below coding I tried to adjust the document size in window but window is not appearing when I click Print button.

Pls help to bring the exact document size in window & make it to print the barcode...

<asp:Button ID="btnPrint"  runat="server" ToolTip="Click Here to Print"
               OnClientClick="ClientSidePrint('divprint');"
               CssClass="add_btn" Text="Print" Height="25" />

               function ClientSidePrint(divBarcodeLabel) {
               var s = $find('MPE1');
               s.show();
               document.getElementById("subhead").style.display = "block";
               var w = 378;
               var h = 283;
               var l = (window.screen.availWidth - w) / 2;
               var t = (window.screen.availHeight - h) / 2;

               var sOption = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t;
               // Get the HTML content of the div
               var sDivText = window.document.getElementById(divBarcodeLabel).innerHTML;
               // Open a new window
               var objWindow = window.open("", "Print", sOption);
               // Write the div element to the window
               objWindow.document.write(sDivText);
               objWindow.document.close();
               // Print the window
               objWindow.print();
               // Close the window
               objWindow.close();
           }

推荐答案

find(' MPE1' );
s.show();
document.getElementById( subhead)。style.display = block;
var w = 378 ;
var h = 283 ;
var l =(window.screen.availWidth - w)/ 2 ;
var t =(window.screen.availHeight - h)/ 2 ;

var sOption = toolbar = no,location = no,directories = no,menubar = no,scrollbars = yes,width = + w + ,height = + h + ,left = + l + ,top = + t;
// 获取div的HTML内容
var sDivText = window.document.getElementById(divBarcodeLabel).innerHTML;
// 打开一个新窗口
var objWindow = window.open( 打印,sOption);
// 将div元素写入窗口
objWindow.document.write (sDivText);
objWindow.document.close();
// 打印窗口
objWindow.print();
// 关闭窗口
objWindow.close();
}
find('MPE1'); s.show(); document.getElementById("subhead").style.display = "block"; var w = 378; var h = 283; var l = (window.screen.availWidth - w) / 2; var t = (window.screen.availHeight - h) / 2; var sOption = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t; // Get the HTML content of the div var sDivText = window.document.getElementById(divBarcodeLabel).innerHTML; // Open a new window var objWindow = window.open("", "Print", sOption); // Write the div element to the window objWindow.document.write(sDivText); objWindow.document.close(); // Print the window objWindow.print(); // Close the window objWindow.close(); }


这篇关于我需要使用asp.net从客户端打印条码的确切大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆