I am trying to print first the price, then the title of a book vertically,
then the bar code, and thats all in a specific locations on a preformatted
label, so below is an attempt to print 2 labels statically (not yet reading
from database or file), and I couldn't print another image of a bar code in
the next label, and the first image couldn't print in any different place but
the current one?
The current Code is:
***************************************************
Private Sub Command_Print_Click()
Printer.ScaleMode = vbTwips ' set the printer scalemode to Twips
' there should be a loop for all barcodes read from database but I am
testing for 2 static ones for now
' first row prints the prices online on top of the bar codes
x = 1300
y = 800
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = 6
Printer.Print " $18"
x = 2500
y = 250
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "A"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " "
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "G"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "i"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "f"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "t"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " "
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "f"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "o"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "r"
' increment x by barcode width to print more on the same line
x = 3500
y = 800
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = 6
Printer.Print " $20"
x = 4700
y = 250
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "A"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " "
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "G"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "u"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "i"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "d"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "e"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " "
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "t"
y = y + 100
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print "o"
x = 100
y = 300
Printer.CurrentX = x
Printer.CurrentY = y
Printer.PaintPicture MyBarCode.Picture, x, y
' I should be able to print more barcodes until the scalewidth of the
'page - mybarcode width is more than the current x position and then
'start the new line
'Next Line for bar codes
' so far works fine, next bar code, doesn't print
'printing the next bar code later on line
'x = x + (MyBarCode.Picture.Width) + 10
'Printer.CurrentX = x
'If x > Printer.ScaleWidth - MyBarCode.Picture.Width Then
' MsgBox "Printing exceeded printer width"
'End If
'Printer.PaintPicture MyBarCode.Picture, x, y
Printer.EndDoc
'the later lines should proceed with x initialized, y incremented by barcode
height, and keep printing prices on one raw, then barcodes on later rows till
the saceheight of the page - barcode height is more than the current y
position
' when the printer height is consumed a new page is started
End Sub
***************************************************
still my question: is overlapping allowed, because inside one label, I keep
going up and doen on the coordinates to print in the right place, and the
barcode image might occupy other tranparent space on the page, that I might
need to overlap,
I appreciate your help, thanks,
Post by ManalHi
***************************************************
Private Sub Command_Print_Click()
Printer.ScaleMode = vbTwips ' set the printer scalemode to Twips
' there should be a loop for all barcodes read from database but I am
testing for 2 static ones for now
' first row prints the prices online on top of the bar codes
x = 1
y = 1
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " $18"
' increment x by barcode width to print more on the same line
x = x + (MyBarCode.Picture.Width) + 10
Printer.CurrentX = x
Printer.CurrentY = y
Printer.Print " $20"
' I should be able to print more barcodes until the scalewidth of the
'page - mybarcode width is more than the current x position and then
'start the new line
'Next Line for bar codes
x = 1
y = y + 300
Printer.CurrentX = x
Printer.CurrentY = y
Printer.PaintPicture MyBarCode.Picture, x, y
' so far works fine, next bar code, doesn't print
'printing the next bar code later on line
x = x + (MyBarCode.Picture.Width) + 10
Printer.CurrentX = x
If x > Printer.ScaleWidth - MyBarCode.Picture.Width Then
MsgBox "Printing exceeded printer width"
End If
Printer.PaintPicture MyBarCode.Picture, x, y
Printer.EndDoc
'the later lines should proceed with x initialized, y incremented by barcode
height, and keep printing prices on one raw, then barcodes on later rows till
the saceheight of the page - barcode height is more than the current y
position
' when the printer height is consumed a new page is started
End Sub
***************************************************
in the sizes I am using, I am not exceeding the printer scalewidth - barcode
width, but if we assume I do, shouldn't it try to overwrite the available
part? or it can't?
because I know I might need to overlap bar code pictures that contain empty
extra spaces that I can't get rid of, but the sample I am testing on is not,
thanks
Post by Jeff Johnson [MVP: VB]Post by ManalUsing the Printer.Print method to print text, doesn't allow me to specify
the X, Y coordinates, and using the Printer.PaintPicture prints only the
first picture on the page and stops, it doesn't print more pictures even if
the page is still empty, and the height and width of the first picture is so
small (a bar code actually that I am trying to print it on a preformatted
labels sheet, with price text in specific location in the label). I tried
changing the x y coordinates after the first printing of a picture, and it
didn't work with my calculation, I tried much smaller differences, and much
bigger differences, and still not good, only prints if I use newpage method,
I can only print on the same x, y coordinates like the first time on the new
page, but I can not change the X Y coordinates even within the printer
scalewidth and scaleheight and continue printing on the same page, or on a
new page? Does that sound familiar, or was reported before?
Sample code please.