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!

Print report to Generic Text Printer

Status
Not open for further replies.

dewildpup

Technical User
Jan 26, 2007
45
BB
Hi Does anyone know of any specifications which would allow Foxpro to print a report to a generic text printer. Now I tried the output to text method such as notepad and RTF from within Foxpro and then print that file to the generic text printer but the font are all screwed up and number after the decimal point will not print.



Your Help is appreciated.



LeVere


 
What exactly do you mean by a "generic text printer"? Do you perhaps mean you are using the generic text driver?

If so, you don't need to output to a text file. Just print the report in the usual way, but select the generic driver when you do.

For that to work, you have to use a single fixed-pitch, preferably at 10 cpi. You can't use bold or italic, nor do you have much control over the vertical spacing. But if you can live with those restrictions, it should work.

But I have to ask --- why do you want to do this? The whole point of the Windows printer driver system is that it allows you to send any report to any printer for which you have a driver? Why would you need a "generic" printer?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike,

I want to print an employee payslip, and the paper size is about 4" in height x 8" width with perforated edges so i can not use a laser printer. Each payslip carries about 12 lines max, including the total line which must alway print in the same place also the printer must use continous feed to go to the next payslip an so on.


So I want to program Fox pro to use the generic text driver and use a specification file which would control the way the printer prints the information.


Regards
LeVere
 
LeVere,

i can not use a laser printer.

So, you're using a dot-matrix printer? Or what?

If so, you certainly don't need a "generic" printer. Just use the printer driver for the specific make and model of printer. In the report designer, set the the page size for the report to match that of the payslip.

I'm doing something very similar right now. I'm printing cheques, in a format very similar to your payslips. There's nothing special about it.

Actually, you could use a laser printer if you wanted to. You'd have to use special stationery (12 x 8 inches) with two rows of perforations. That way, you'd get three payslips per sheet. But it would work jsut as well with a dot-matrix and continuous stationery.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I am using an okidata printer, ok how do you account for the character after the decimal point not printing. I was hopint to use a generic text driver so that when I distribute the program I would not have to modify it to suit another printer particular type of printer each time.



LeVere
 
There is actually a Windows "Generic/Text only" printer driver but that's not what you want, it sounds like.

If you're getting truncated results, that means you need to make the report field a little wider. It only takes a few pixels in the designer to make a difference.

Remember that Foxpro doesn't do any actual printing. It sends a picture to the printer driver, and the printer driver translates that picture into something the printer can understand.

You don't want "generic" at all -- you want very highly customized and specific.

You need to pick the printers you will/won't support and publish that list to your users.
 
LeVere,

I was hopint to use a generic text driver so that when I distribute the program I would not have to modify it to suit another printer particular type of printer each time.

But you don't have to modify the program for different printers.

As I've been trying to explain, the user simply chooses the printer driver for their make and model of printer. This is exactly the same as what happens when you print a document in Word or Excel. The authors of those programs don't know what printer you have installed. They just give you a "choose printer" dialogue, and the Windows printing system does the rest.

You do exactly the same in your VFP application. You certainly don't need a generic/text-only driver.

If your report is not showing the correct information (such as the lost character after the decimial point), that has got nothing to do with the choice of printer driver. It points to a problem in the layout of the report.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I wish you were right. For one when I print to a windows printer the results are fine. I have a VFP program which currently prints the payslips using a generic text driver on preprinted forms.

Therefore if I am going to make any modification I must acheive a similar result. But the current VFP program does use a generic text driver of that I am sure.


regards

Levere
 
Levere,

But the current VFP program does use a generic text driver of that I am sure.

OK. So carry on using it if that's what you feel comfortable doing.

But it's got nothing to do with the fact that you are losing a digit after the decimal point. You need to look for a different solution to that problem.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Yes I know and thats why I think is has something to do with the print driver specification such as CPI and so . Thats why I was asking you guys for Help in the first place. To come up with a different solution!!!!!!!!!!!!!!!.

Perhaps some type of compression is involved.

Since my paper size is about 4" in height x 8" across.

Regards


LeVere
 
LeVere

In my office, I print everthing on a laser EXCEPT for lables. We print them on an OKIDATA. I had similar problems. I agree with Mike, using a windows print driver should work, but I was unable to do it. My work around was output to a text file. I used NET SET command to set LPT2 to the shared OKIDATA printer. Then issued the dos command COPY TEXT.TXT TO LPT2.

It's not an elegant way, and may cause setup problems if you are asking others to set their machines this way. If you find a better way, I'm intrested myself.

Jim Rumbaugh
 
Here's the code I have in a method I call DosLabelPrinter. An example of use would be :
ThisForm.DosLabelPrinter( 'Joe','Blow','123 street')

Code:
PARAMETERS	cString1 , cString2 , cString3 , cString4 , cString5 
LOCAL cFileName
cFileName = "\RumLabel.lbl"


*** print to dos / dot matrix printer via a saved text file
SET ALTERNATE TO ( SYS(5)+SYS(2003)+cFileName )
SET ALTERNATE ON
SET CONSOLE OFF 

** by starting with ?? , I was able to shift print up 1 line 
?? IIF( VARTYPE( cString1 ) = "C" , cString1 , "")
?? CHR(13)+CHR(10)
?? IIF( VARTYPE( cString2 ) = "C" , cString2 , "")
?? CHR(13)+CHR(10)
?? IIF( VARTYPE( cString3 ) = "C" , cString3 , "")
?? CHR(13)+CHR(10)
?? IIF( VARTYPE( cString4 ) = "C" , cString4 , "")
?? CHR(13)+CHR(10)
?? IIF( VARTYPE( cString5 ) = "C" , cString5 , "")
?
?
SET ALTERNATE OFF
SET ALTERNATE to
SET CONSOLE ON
*** I HARD CODED "lpt2" which is redirected to network printer
COPY FILE ( SYS(5)+SYS(2003)+cFileName ) TO LPT2

You would have to tweek it to print checks the way you want.

Jim Rumbaugh
 
Buy your payslips 3 to view on a 12" x 8" sheet with cross perforations between payslips.

Then use your laser printer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top