在纸上打印条形码图像列表,但它只打印第一页 [英] printing list of barcode images on paper,but its printing only first page
问题描述
我想在纸上打印图像列表。为此我使用了PrintDocument类。
当我打印时,它只打印第一页。
之后我做了一行 e.HasMorePages = true;
然后它在页面上进行数字打印,即使我没有太多数据,图像也每次重复。
以下是我的代码。
当我插入e.HasMorePages = True;时,即使我传递了两三张图像,它也会继续打印。
I want to print list of images on paper.for this I have used PrintDocument Class.
When I give print, It will printing only first page.
After that I made one line as e.HasMorePages = true;
Then Its countineously printing on pages,even though I haven't much data,Images are repeating every time.
Below is my code.
When I insert e.HasMorePages=True;, it keeps on printing even though I passed two or three images.
private void PrintPage(object o, PrintPageEventArgs e
{
List<eanbarcodeprintsourcemodel> EANBarcodePrintList = new
List<eanbarcodeprintsourcemodel>();
if (Session["Print"] != null)
{
int count = 50;
EANBarcodePrintList = Session["Print"] as List<eanbarcodeprintsourcemodel>;
for (int i = 0; i < EANBarcodePrintList.Count; i++)
{
string labelData = EANBarcodePrintList[i].ItemCode + " " +
EANBarcodePrintList[i].StyleNo + " " +
EANBarcodePrintList[i].PlatingCode + " " +
EANBarcodePrintList[i].ColourCode;
string MRPAmount = "MRP." +
EANBarcodePrintList[i].ProductMRPAmount.
ToString("N", new CultureInfo("te-IN"));
e.Graphics.DrawString(labelData,
new Font("Tahoma", 7),
Brushes.Black,
new PointF(50, 40 + (count + 50 + (i * 50))));
count += 30;
e.Graphics.DrawImage(EANBarcodePrintList[i].NormakBarcodeImage,
50,
count + 70 + (i * 50), 150, 40);
count += 20;
e.Graphics.DrawString(EANBarcodePrintList[i].NormakBarcode,
new Font("Tahoma", 7),
Brushes.Black,
new PointF(90, 40 + (count + 50 + (i * 50))));
count += 30;
e.Graphics.DrawImage(EANBarcodePrintList[i].EanBarcodeImage,
50,
count + 70 + (i * 50), 150, 40);
count += 20;
e.Graphics.DrawString(EANBarcodePrintList[i].EANBarcode,
new Font("Tahoma", 7),
Brushes.Black,
new PointF(90, 40 + (count + 50 + (i * 50))));
count += 10
e.Graphics.DrawString(MRPAmount,
new Font("Tahoma", 7),
Brushes.Black,
new PointF(110, 40 + (count + 50 + (i * 50))));
count += 30;
}
}
你能否建议我应该把e.HasMorePages = true和e.HasMorePages = false;在上面的代码中?
提前致谢,
Kiran
Can you please suggest Where I should put e.HasMorePages=true and e.HasMorePages=false; in above code?
Thanks in advance,
Kiran
推荐答案
这篇关于在纸上打印条形码图像列表,但它只打印第一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!