How to print using on paper with fixed-width and dynamic height

I'm developing a Point Of Sale (POS) app in VB.NET and .NET Framework 3.5 where multiple items can bought at a time. I need to print all items: their code, name quantity, price in a row-column manner.

SHOP NAME            date
==========           =====
SL   CODE      NAME     QTY      PRICE
==   =====     =====    ===      =====
1    ANC-059   Pencil   1        $2.00
2    ASNC-009  Pencil   1        $2.00
3    ASNC-09   Pencil   1        $2.00
4    ASNC-009  Pencil   1        $2.00

The width of page is fixed but the height will be dynamic.

The printout will be printed on rolled paper normally used in a POS system.

How can this be done?


Standard winforms printing:

    'Set up the document for printing and create a new PrintDocument object.
    Dim pd As New Printing.PrintDocument
    'Set the event handler for the printpage event of the PrintDocument.
    AddHandler pd.PrintPage, AddressOf pd_PrintPage
    'Set the printer name.
    pd.PrinterSettings.PrinterName = PrintDialog1.PrinterSettings.PrinterName
    'Print the document by using the print method for the PrintDocument, which triggers the PrintPage event
Catch ex As Exception
End Try

'The PrintPage event is raised for each page to be printed.
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs)
    'Set up the default graphics object that will be used to do the actual printing.
    Dim g As Graphics
    g = ev.Graphics

    Dim tHeight as Double
    Dim txt as String = "My text goes here"
    g.DrawString(txt, myFont, myBrush, xPosition, yPosition, StringAlignment.Near)
    'Measure the height (on the page) of the item that you have just drawn, so that
    'you can place the next item below it.
    tHeight = g.MeasureString("Customer", fntBlue).Height()

    txt = "My new line of text"
    g.DrawString(txt, myFont, myBrush, xPosition, yPosition + tHeight, StringAlignment.Near)

    '.....continue printing other items
End Sub

Need Your Help

HttpPost fails doing its function

android http post try-catch progressdialog

I'm trying to send a URL with some parameters using HttpPost but it has no success. I'm using this code:

Google App Engine Python, virtualenv and mimetypes

python google-app-engine virtualenv

I have working project built with djangoappengine and running under App Engine dev server. So I run " runserver" and all works as appreciated. All requirements (django, djangoappengine etc...