none
How to set receipt alingment

    Question

  • <g class="gr_ gr_8 gr-alert gr_gramm gr_disable_anim_appear Punctuation only-ins replaceWithoutSep" data-gr-id="8" id="8">Hello</g> Guys, <g class="gr_ gr_11 gr-alert gr_tiny gr_spell gr_disable_anim_appear ContextualSpelling multiReplace" data-gr-id="11" id="11">i</g> want to set my receipt alignment my receipt alignment <g class="gr_ gr_10 gr-alert gr_spell gr_disable_anim_appear ContextualSpelling" data-gr-id="10" id="10">is to</g> dirty and <g class="gr_ gr_12 gr-alert gr_tiny gr_spell gr_disable_anim_appear ContextualSpelling multiReplace" data-gr-id="12" id="12">i</g> <g class="gr_ gr_7 gr-alert gr_spell gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="7" id="7">dont</g> know how to set standard print receipt alignment 
    please see my receipt alignment

    http://imgur.com/a/DQWfM

    <g class="gr_ gr_38 gr-alert gr_tiny gr_spell gr_run_anim ContextualSpelling multiReplace" data-gr-id="38" id="38">i</g> am using this code for print receipt

    Graphics graphics = e.Graphics;
                Font f = new Font("Arial", 8);
                float fontHeight = f.GetHeight();
                int starto = 30;
                int startp = 6;
                int startoo = 180;
                int startpp = 9;
                int startX = 10;
                int startY = 10;
                int offset = 40;
                int offset1 = 260;
                int offset2 = 280;
                int line = 1;
                int line1 = 5;
                int line2 = 6;
                int line3 = 24;
                int line4 = 124;
                int line5 = 32;
                int line6 = 20;
                int line7 = 3;
                int line8 = 6;
                int line9 = 32;
                int offset3 = 250;
                int offset4 = 260;
                int offset5 = 270;
     
                graphics.DrawString(txtDisplay.Text, new Font("Courier New", 6), new SolidBrush(Color.Black), line, line1);
                graphics.DrawString(setaluefortext00001name, new Font("Courier New", 15), new SolidBrush(Color.Black), starto, startp);
                graphics.DrawString("*****************************************************************", new Font("Courier New", 6), new SolidBrush(Color.Black), line2, line3);
                graphics.DrawString(label4.Text, new Font("Courier New", 6), new SolidBrush(Color.Black), line8, line9);
                //graphics.DrawString("Order No: "+ + label2.Text, new Font("Courier New", 6), new SolidBrush(Color.Red), line4, line5);
                foreach (tblProductEx product in products1)
                {
                    //for (int z = 0; z < dataGridView2.Rows.Count - 1; z++)
                    //{
                        string productDescription = product.productName.PadRight(30);
     
                        string productTotal = "Rs:" + string.Format("{0:}", product.productPrice);
                        string prodcutLine = productDescription + productTotal;
     
                        graphics.DrawString(prodcutLine, f, new SolidBrush(Color.Black), startX, startY + offset);
     
                        offset = offset + (int)fontHeight + 5;
                    //}
                }
                offset = offset + 20;
                tblTransaction transaction = new tblTransaction();
                transaction.transactionDate = DateTime.Now;
                graphics.DrawString("Total To Pay".PadRight(15) + "Rs " + string.Format("{0:}", total1), f, new SolidBrush(Color.Black), startX, startY + offset3);
                graphics.DrawString("Thank You For Coming,".PadRight(15) + string.Format(""), f, new SolidBrush(Color.Black), startX, startY + offset4);


    Thursday, October 13, 2016 8:45 PM

Answers

  • If ASP.Net then I'd ask in Microsoft official forums over here.

    https://forums.asp.net/

     

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.


    Thursday, October 13, 2016 10:56 PM
    Moderator