Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble switching printers
Message
From
24/10/2003 16:41:59
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00841753
Message ID:
00842457
Views:
27
>>>>You have to clear the fields specified AND do a SET PRINTER TO NAME (whatever).
>>>>
>>>>You can do a GETPRINTER() to see what the names should be in your code.
>>>
>>>Thanks for the help, Fred. I am getting some different results now but there are still glitches. One change I made was to bind the value of the printer name to the first column of the array returned by APRINTERS() rather than the second column. Now if I have the physical LAN printer as my Windows default and select Acrobat as my application printer, that works fine. But now I can't print to the physical printer. I think possibly I am misusing APRINTERS(), which may explain at least part of my problem. Which column should I be binding to? FWIW here is what APRINTERS() returns -- note that the one physical printer (attached to another PC on the LAN) is in there twice.
>>>
>>
>>It's the first entry of each row:
>>
>>yourarray[x,1]
>>
>>
>>>=APRINTERS(laPrinters)
>>>laPrinters[1,1] = "Auto hp officejet k series on DELLMIKE"
>>>laPrinters[1,2] = "\\DELLMIKE\hpoffice"
>>>laPrinters[2,1] = "Acrobat PDFWriter"
>>>laPrinters[2,2] = "LPT1:"
>>>laPrinters[3,1] = "\\DELLMIKE\hp officejet k series"
>>>laPrinters[3,2] = "DOT4_001"
>>
>>So that would be the "Auto hp officejet k series on DELLMIKE" or "Acrobat PDFWriter" or "\\DELLMIKE\hp officejet k series".
>>
>>If you're using the first one as an example, you would do:
>>
>>SET PRINTER TO NAME (laPrinters[1,1])
>>
>>The parenthesis are important!
>>
>>
>>>When I go into my maintenance dialog, the third choice is grayed out / disabled.
>>>
>>>Also, now that TAG, TAG1, and EXPR are blanked in the first record of the FRX, my report is printing portrait. How can I change it back to the desired landscape orientation without dragging a printer name in with it?
>>
>>You'd have to leave only the ORIENTATION=1 part of the EXPR memo field.
>
>
>
>
>OK, here is the latest. I thought it was fishy that there were two drivers for the same printer, so deleted both of them and then re-added the physical printer using the normal Add Printer dialog in Windows. Per your advice I am binding the first column of the APRINTERS() array to the printer name in my user table. I verified that what gets stored matches the first column values from APRINTERS().
>
>Here are the values now returned by APRINTERS():
>
>laPrinters[1,1] = "Acrobat PDFWriter"
>laPrinters[1,2] = "LPT1:"
>laPrinters[2,1] = "\\DELLMIKE\hp officejet k series"
>laPrinters[2,2] = "DOT4_001"
>
>And here is what is happening now for each of the possible scenarios:
>
>1. Windows default HP, flag says use Windows default, application default = HP --> prints to HP [RIGHT]
>
>2. Windows default = HP, flag says use Windows default, application default = Acrobat --> prints to HP [RIGHT]
>
>3. Windows default = HP, flag says use application default, application default = HP --> prints to HP [CANNOT TEST -- CANNOT CHOOSE "\\DELLMIKE\hp officejet k series" IN DIALOG LISTBOX -- ONLY THE FIRST SLASH APPEARS AND IT IS GRAYED OUT / DISABLED]
>
>4. Windows default = HP, flag says use application default, application default = Acrobat --> prints to Acrobat [RIGHT]
>
>5. Windows default = Acrobat, flag says use Windows default, application default = HP --> [CANNOT TEST BECAUSE CANNOT SELECT “\\DELLMIKE\hp officejet k series" IN DIALOG LISTBOX -- ONLY THE FIRST SLASH APPEARS AND IT IS GRAYED OUT / DISABLED]
>
>6. Windows default = Acrobat, flag says use Windows default, application default = Acrobat --> prints to HP [WRONG]
>
>7. Windows default = Acrobat, flag says use application default, application default = HP --> [CANNOT TEST BECAUSE CANNOT SELECT HP]
>
>8. Windows default = Acrobat, flag says use application default, application default = Acrobat --> prints to Acrobat [RIGHT]
>
>
>So I am down to two problems. One is not being able to select the HP printer because its name starts with a double slash. I vaguely remember dealing with this years ago but don’t remember how. Do you know? The other problem is #6, where the Windows default printer and the application default are both Acrobat but for some reason the report goes to the HP.
>
>I will put ORIENTATION = 1 back into the EXPR field and hope that gets the report back in landscape orientation.
>
>Thanks again to everyone who has been helping.

If you're trying to put this stuff into a listbox, the "\" will be problematic. I think you have to add 2 more "\\" to the front of it and an additional "\" in front of all the single slashes. The backslash is essentially an "escape" character, so inorder to see a "\", you need to double it up.

forget the above paragraph!

After actually checking it out < g> , all you need to do is add a space before the printer name with the "\\". Then you'd need to do SET PRINTER TO NAME (ALLTRIM(laPrinters[x,1])).

I have no idea why it would still print to the HP, unless you haven't cleared out the other memo fields besides EXPR on that first record.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform