I'm using StarDoc , EndDoc to print text rotation and image, but i print text only.
Here my code:
hPrintDc = CreateDC(Printer.DriverName, Printer.DeviceName, 0, 0)
result = StartDoc(hPrintDc, di) 'Start a new print document
result = StartPage(hPrintDc) 'Start a new page
' hMemoryDC = CreateCompatibleDC(GetDC(0))
'mBitmap = CreateCompatibleBitmap(hMemoryDC, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
' Select our rotated font structure and save previous font info
hOldfont = SelectObject(hPrintDc, hFont)
'Select the bitmap into the device context
'result = SelectObject(hMemoryDC, mBitmap)
' Send rotated text to printer, starting at location 1000, 1000
TextOut hPrintDc, 1000, 1000, OutString, Len(OutString)
' Reset font back to original, non-rotated
SelectObject hPrintDc, hOldfont
'SelectObject hMemoryDC, hOldBitMap
Dim path As String
path = "C:\cup.bmp"
Picture1.Picture = LoadPicture(path)
Printer.PaintPicture Picture1.Image, rect.X, rect.Y, Picture1.Width, Picture1.Height
'TextOut hPrintDc, 2000, 2000, Picture1.Image, Len(path)
Printer.EndDoc
' Send non-rotated text to printer at same page location
'result = TextOut(hPrintDc, 1000, 1000, OutString, Len(OutString))
result = EndPage(hPrintDc) 'End the page
result = EndDoc(hPrintDc) 'End the print job
result = EndDoc(hMemoryDC)
result = DeleteDC(hPrintDc) 'Delete the printer device context
result = DeleteObject(hFont) 'Delete the font object
result = DeleteDC(hMemoryDC)
Current, it's printing 2 files.
File 1 contains image
File 2 contains text
How can i print 1 file contains image and text?
Thanks