PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2010 Set the PrintDocument Height when printing on Receipt Printer-VBForums
Results 1 to 5 of 5

Thread: Set the PrintDocument Height when printing on Receipt Printer

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,098

    Set the PrintDocument Height when printing on Receipt Printer

    Hi.
    Currently i am using PrintDocument to print Sales Receipts on either A4 or A5 size. Now its required to print on an Receipt Printer, for which i am unable to set the paper height dynamically.

    I have Googled and found that we need to create an custom size and set the paper size. But the custom size is not useful as the height depends on no of products in the invoice.

    I have used the following code, the paper is being print and cut till Line54 (till the size of A4)

    vb Code:
    1. Private Sub Thermal_PrintPage1(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
    2.         Dim BoldFont As New Font(Me.Font.Name, 12, FontStyle.Bold)
    3.         Dim RegularFont As New Font(Me.Font.Name, 10, FontStyle.Regular)
    4.  
    5.         Dim t As String = ""
    6.         t = Me.CompName & Environment.NewLine
    7.  
    8.  
    9.         Dim PointY As Integer = 50
    10.         For i As Integer = 0 To 70
    11.             PointY += 20
    12.             e.Graphics.DrawString("Line " & CStr(i) & Environment.NewLine, RegularFont, Brushes.Black, 10, PointY)
    13.         Next
    14.  
    15.     End Sub

    please help to set the page height
    Regards

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    21,828

    Re: Set the PrintDocument Height when printing on Receipt Printer

    So your papersize is 20px * number of items? Isn't that possible?

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    21,828

    Re: Set the PrintDocument Height when printing on Receipt Printer

    You need to dynamically set your papersize depending on the number of items, which in your example is 1400px plus your initial 50px. I haven't tried it, but why wouldn't that be possible???

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,098

    Re: Set the PrintDocument Height when printing on Receipt Printer

    Thanks for your suggestion

    It would partially help me. I was planning to print the Header with some Bold and Big size fonts. Footer with some other details and messages.

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    21,828

    Re: Set the PrintDocument Height when printing on Receipt Printer

    The Graphics object has a MeasureString method. You can measure your receipt parts exactly. As for defining custom page sizes, that's the part i haven't tried...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width