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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use an specific font when printing using the ? in visual fox pro 9

Status
Not open for further replies.

Luiz Eduh

Technical User
Jan 10, 2012
51
US
Hi, im trying to print to a label and i can make it to print a line using a specific font.
I read several forums and people suggest to use the ? to print on dot matrix printer for the types of labels im using, well i tried and most of the data shows in the printout except a field where i have a upc number store, i want to print this number using a font called upca which generates a barcode. Anyways im calling something like this to print to the label, like i said everything prints fine except the line where I want the printout with the upca font. I also tried using the report and the label from within vfp9 and it works fine, the only thing is that even though im especifying a size of the label it print like if im printing in a letter size sheet. i tried creating a custome paper form from within windows and had no luck, anyways using the ? show okay but i need help how to use the upca font in the second line of code below.
? descript
? upca(inv->upc) font "upca" && this is where im trying to us the upca font to print what is stored in the inv->upc field but the printout doesn't show the font, its not working. Do you have any idea how i can acomplish this?

Thank
 
I;m not sure I completely understand your question, but using ? to print labels is very unsatisfactory, and not the recommended method.

Have you tried using the CREATE LABEL and LABEL commands? Those are usual way to create and print labels in Visual FoxPro. The labels can contain any mix of fonts that are visible to Windows, including barcode fonts.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
As Mike says, using ? to print is the least optimal way to print.

If you MUST do so, however, you control the output font with SET PRINTER FONT (see the help file for syntax).
 
Thanks for the suggestions, using a report or a label in vfp9 the data prints fine, but if you see on the attached left image it prints a label and skips 9 blank labels and then it print the other label. Now if you see the image on the right im using the ? to print the data to the label and the label prints one after another, but for some reason it doesnt print what i have stored on the upc field using the font upca that generates the barcode, it only prints using the same font as the other fields. Here is the code im using to print the label from the right image using the ? ;

? descript
? upca(inv->upc) font "upca"
? ltrim(str(shipqty,5)) ;
+iif(tanks<>' ','TANKS: '+tanks,' * * NO TANKS * *')
? prodnum + tran->trannum+' LINE'+ltrim(tranline)
? tran->cusname
? inv->sku01

but line 2 doesnt seem to use the font upca

Thanks any ideas that you can help with? btw im printing these labels on a dot matrix printer.
 
 http://imageshack.us/photo/my-images/684/labelsc.jpg/
Well, the first question is: Are you sure the font is installed on the system you are running this on?

Also, is this a scalable font? If it isn't, you might need to specify the font size as well. If you omit the font size, VFP will default to 10 pt, and if no 10 pt font is available ... well, I'm not sure what will happen.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes, it is installed. Its okay if it defaults to 10 points.
 
This is how the font looks in the windows font folder; (please see attached image) It seems that this project its impossible, I can't believe there is no way to print labels properly from winthin vfp9 to a microline 321 turbo dot matrix printer. I still can figure out how to prevent the skipping of white labels after the first is printed. Using the question marks work, but it seems that i can't use a different font, which is the upca font i have installed on my windows machine. If i could only be able to print with the report one label after another would really solve my issue.

Hope you have more ideas that i could try. :)
 
 http://imageshack.us/photo/my-images/806/fontinwindows.jpg/
Before you say the project is impossible, why don't you try systematically eliminating the variables to see where the fault lies.

For example, try printing the font from another application (not FoxPro), or from within Foxpro but not with the ? command (for example, in a report).

Then try running your existing code, but with a different font in place of "upca".

Or with your existing code, but at different sizes.

And so on.

This is how you find out exactly where the problem is. You can't solve a problem until youi know what it is.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
In a Prg you can use this:

set printer font "Courier New", 8
&&& then dont forget define the device
use yourtable
set devi to print
 
Hi, using that font prints fine from other windows applications, even using the report and label tools from vfp9. Like you can see on the image link, the labels on the left are printed from a report and i also tried from a label, which prints fine to the okidata microline 321 printer, it also prints what i have stored on the upc field using the upca font, but the labels on the left is not printing the upc field using the upca font, it only prints what i have stored on the upc field on regular font, its not picking the upca font. This is done from the same vfp 9 program we run on the company. When using the report prints fine, but as you can see on the image it prints one label and skips like 9 labels until it prints the other label. This what we currently do our company program;

we have a table with different records and every record has its own upc number, The process we work is; our customers calls in and we put an order on our vfp9 program, once we have the order we print a picksheet for the warehouse to complete the order, every item sold to the customer prints a label that need to be attached to the item, look at the image i attached, so if the order have 10 different item, the program prints a picksheet on a regular laserjet with the description and puts every item by line, lets say 1,2,3,4 etc.... then as soon as the picksheet prints, labels are printed in a okidata microline 321 turbo. Currently we are printing the labels using the ? sign (on the image link the labels are the ones on the right), but because now we need to create barcodes for each item, there is a need to use a report or label because I cant seem to find a solution doing it with the ?. This is my problem the data is printing fine using a report or label, but because we need to print to the okidata I cant seem to find a way to continuously print a label and then following the other one below, its printing the right data but it skips like 10 blank label when one its printed, if we have 10 items it would waste too many labels. Some metioned i need to create a custom form withing windows to match the size of the label, but i cant, because apparently its not posible with this printer. Please see the code below that im currently using on this prg; I remarked out the code that prints from the link of the image the labels on the right, because i tried using a report. If i can get the upc field using the ? to print using the upca font which is the 2 lines belows the line where im generating the report that would be what i need. Thanks for your help

* print the baglabels
sets = 0
if Category->baglabels
do while m->sets < s_labsets
sets = m->sets +1
if upper(m->labels)<>'N'
goto top
do prt2file with 'P',u_labelprn, u_labport
do while trannum=tran->trannum .and. !eof()
if upper(m->labels)='A' .and. printlabel='Y'
skip
loop
endif
if m->sets = s_labsets
select tstat
seek temp1->trannum+temp1->tranline
if found()
rec_lock()
replace printlabel with 'Y'
dbcommit()
unlock
endif
endif
select temp1
if cus->skucode#'01'
? sizename+' '+descript
? ltrim(str(shipqty,5)) ;
+iif(tanks<>' ',' FROM TANKS: '+tanks,' * * NO TANKS * *') ;
+'('+ltrim(str(ordqty,5))+')'
? 'ITEM '+prodnum + 'ORDER '+tran->trannum+' LINE '+ltrim(tranline)
? tran->cusname
? cus->cuscity
?
else
set procedure to barcode.prg additive
select inv
set order to 1
seek temp1->prodnum
select temp1
<B>report form &u_comdir.label.frx RECORD RECNO() TO PRINTER PROMPT NODIALOG PREVIEW plain</B>
* ? descript
* <B>? upca(inv->upc) font "upca"</B>
* ? ltrim(str(shipqty,5)) ;
* +iif(tanks<>' ','TANKS: '+tanks,' * * NO TANKS * *') && ;
* +'('+ltrim(str(ordqty,5))+')'
* ? prodnum + tran->trannum+' LINE'+ltrim(tranline)
* ? tran->cusname
* ? inv->sku01
?
* ? sizename+' '+descript
* ? ltrim(str(shipqty,5)) ;
* +iif(tanks<>' ',' FROM TANKS: '+tanks,' * * NO TANKS * *') ;
* +'('+ltrim(str(ordqty,5))+')'
* ? 'ITEM '+prodnum + 'ORDER '+tran->trannum+' LINE '+ltrim(tranline)
* ? tran->cusname
* ? cus->cuscity
* ?
endif
skip
enddo
* feed labels forward on printer
if m->whichcat < m->cats
?
?
?
?
?
?
else
for i = 1 to config->labelsfeed
?
next
endif
do prt2file with 'D',u_labelprn, u_labport
endif
enddo
endif
enddo
select temp
enddo
select temp
use
select temp1
use
return
 
 http://imageshack.us/photo/my-images/684/labelsc.jpg/
Sorry, the example I post is relative to simple reports using @ say.

@10,5 say subtot pict xp1 style "NT
 
@10,5 say subtot pict xp1 style "NT" Where should i put this? sorry i dont get it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top