Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to print image on printer

Status
Not open for further replies.

sandeep kamble

Technical User
Oct 19, 2016
4
IN
hi friends
in vfp how to print image with the help of prg on printer
 
Can you be more specific?

Do you mean your own help texts or something from VFP?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
The straight forward answer: Design a report with an image (Picture/OLE bound control). Set control source type to "Expression or variable name" and then Control source must be a field of the report driving table or cursor or view (anything in the currently active datasessions currently selected workarea at the time of running the report, if the report doesn't have its own private datasession), which contains the file name of the picture to print.

It could be a little simpler, to set control source type to "Image file name" and set control source to exactly that: The picture file name, but a) this would only print that image and nothing else. It's OK for a logo you want on your report, for example, but more tricky b) it would still not work, if there is no record in any table, cursor or view driving the report.

VFP reports need data to drive them. They don't even print static parts like label captions or images wired to a certain image file, if there is no report driving data. At minimum you need a cursor with a single record, even if you don't address any field of it. Therefore an image control set to be fed with the file name of an image file from a workarea field is the easiest to not forget the essential report driving data. Just remember VFP reports are mainly for reporting data, so it's only natural the report engine looks for data to print and if nothing is found quits. It gets even clearer, if you know the REPORT FORM command has a FOR clause filtering the current workarea for what to print of it, like any other xBASE command related to workareas. So the REPORT FORM command was always concerned with a workarea and it's data as the main concept of the whole Foxpro language. Reports with their own private datasession most probably are a feature which was not part of the first report implementation.

Overall a report is not a self contained document, you can't embed images into it, like you can't embed data. Like with HTML img tags images remain extra files and the picture control is just having a source of what file to print more or less directly.

Bye, Olaf.
 
Thanks sir

OlafDoschke (Programmer) Sir am printed image from vfp report. But i want to print through programme. i have one project. in which the company want the company logo is print on every statement of company which is print from programm.
 
Olaf has already given you most of the answer.

You presumably already know how to print a statement. All you have to do is to open the statement in the report designer, and drop an image (Picture/OLE bound control) onto the report (probably in the Page Header band). In the Picture/OLE Bound properties dialouge, set the Controlsource Type to "image filename" and set the Controlsource to the path and name of the company's logo file.

I'm not sure I understand why you are specifically asking how to "print through programme". Printing a report with a logo is exactly the same as printing any other report.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
...I mentioned REPORT FORM command especially in the detail of the FOR clause, but generally this is "programmatically" printing. You just prepare a report by designing it. In the same manner you also design forms for programmatically calling them later with DO FORM. You can but don't write code to start an empty form and put controls on it with their code, you also don't put together FRX controls at runtime or HTML and CSS and Javascript, you design forms and reports and menus for execution at runtime. This is desktop programming, not web development.

If you have code using Generic/Text printer and ??? or ?? commands or even @Say,\ and \\ to print, you don't print graphics this way, unless you know ESC sequence codes for your printer. We have Windows printing and printer drivers and GDI+ since Windows 98 and you should use that. It's not only the easiest option to go through a report, it's also the best way to print anything from VFP, as it offers much more convenience of defining the report layout than fiddling with escape sequences of printers own languages. Reports can then also be reused, they are printer independent (unless you embed printer environment and driver specific settings). In general, if a printer prints A4 or Letter size and has a windows printer driver, you will get the report printed on it.

The REPORT FORM command also mentions:
VFP Help said:
You can also use REPORT FORM to run character-based report files created in FoxPro for MS-DOS.
If you have such report files, it's certainly time to move to visual FRX reports.

Bye, Olaf.
 
printed image from vfp report. But i want to print through programme.

Based on your statement, you seem to be unfamiliar with VFP and how to print a 'report' from within an application.

You might want to take time to look at some of the free, on-line VFP tutorial videos at:

Of particular interest might be the videos labeled:
Basic Reporting - Pt. 1​
Basic Reporting - Pt. 2​

That information combined with what Olaf has already given you should assist you in what you want to do.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top