Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting print mode (Landscape vs. Normal) programmatical
Message
De
08/04/2003 16:44:28
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00775228
Message ID:
00775242
Vues:
15
This message has been marked as a message which has helped to the initial question of the thread.
http://www.sturec.com/printers.htm
http://www.quickanswer.com/driversccodes.htm

For example, to set an HPLJII compatible printer to landscape mode you can do the following in decimal mode:
set PRINTER on
set DEVICE TO printer
??? CHR(27)+CHR(38)+CHR(108)+CHR(49)+CHR(79)
? "this is a test"
set DEVICE TO screen
SET PRINT OFF
or you can send the codes using ??? and escape sequences pulling them from the prntcode.dbf table.

like 10cpi on an hpljIII would be set like this:

??? chr(27)+"&12U"+chr(27)+"(s0p10.0h12.0v0s0b3T"

These printer escape codes are available online (do a search and you will find MANY results) or in the printer manual.



>Great link, Tracy. I will check, if this example could be easily converted into VFP code. I would be also interested, where are the printer codes online and how do you send them? Using ??? syntax?
>
>Thanks again.
>
>Well, I checked the code and see, that it uses Printer.hDC, which doesn't have analogue in VFP. It also uses a simple structure.
>
>So, perhaps solution should be to create a VB COM.
>
>I even now remembered about something like that in Downloads section VBPrinter, which I didn't try to use.
>
>>Update: here is an example but it is in VB:
>>
>>http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/html/msdn_msdn116.asp
>>
>>
>>If it is a report, you could edit the frx programmatically. We do this in our programs for different reasons. We copy the frx to a temporary file and change the settings we need to and run the temp file frx instead of the original in code. Other than that, the only way I know of is to send the printer control codes to the printer using ??? in code which is dependent on your printer, although many printers accept standard hp LJII, IBM, or Epson codes. All of our laserjets and ink jet printers accept LJII codes and all of our dot matrix printers accept Epson or IBM codes. For sending printer control codes, I did cheat and pull most of them from the prntcode.dbf that came with FPD26.
>>
>>As I think about this a bit more, it seems there should be an API that you could call to do this...
>>
>>>Hi everybody,
>>>
>>>Do you know, how can I set printer mode programmatically either Landscape or Normal? I would prefer to have a general approach and not printer specific codes...
>>>
>>>Thanks in advance.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform