473,379 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How to print image and Text using StarDoc, EndDoc

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
Oct 25 '14 #1
0 1063

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
2
by: strout | last post by:
It's a pain to create each button with 2 images: button_on.gif button_off.gif I am looking for a control that have on/off two states, preferred as BACKGROUND images and with button text on it. ...
1
by: GeorgeB | last post by:
I use HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET <URL:http://support.microsoft.com/?scid=kb;EN-US;322090> to send text to a dotmatrix printer. I cannot print localized text...
1
by: osmarjunior | last post by:
I read some messages in the group about printing in text mode. The PrintDocument class didn't solve my problem, because it prints in graphic mode. I have a matrix printer, and printing in text...
6
by: Lorenzo Thurman | last post by:
Does anyone know how to validate a particular image type using PHP? If I have a file and I want to ensure that it is a jpeg, how would go about it? A sort of is_jpeg or is_gif is what I'm seeking....
0
by: thirunavukarasukm | last post by:
Hai.... To print Html page using PrintDialog and Print Document i am created one windows appication.. the windows application have many pages in my booking page i have two buttons one...
8
by: Firecore | last post by:
Is it possible to print a text file using C? like, to get filename as input and then to print it?
4
by: barronmo | last post by:
I'm a beginner searching for an easy way to print the contents of a text control. So far I've come up with the following(difficulties): 1) using wxPython -convert to HTML and then print (I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.