Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Set Printer To ... - does not change printer

3,406 views
Skip to first unread message

benjamin

unread,
Sep 3, 2008, 4:36:06 PM9/3/08
to
I have VFP 8 and Adobe Acrobat Prof.

I am attempting to have the user print directly to a PDF with code in
a commandbutton rather than going through the dialog box and select
the PDF driver.

I have tried :

lcprinter="Adobe PDF" && installed driver
set printer to (lcprinter)
report form MyForm.frx noconsole to printer

The report always goes to the Windows default driver (?set("printer",
2)).

I have unchecked the "printer environment" box on the reports menu for
the report form.

I can get it to work if I run it with a PROMPT command:

report form MyForm.frx noconsole to printer prompt &&this displace
the select printer dialog box

Any suggestions on how to print directly to a PDF file without going
through the printer dialog box?

Fred Taylor

unread,
Sep 3, 2008, 8:54:08 PM9/3/08
to
You need to use the SET PRINTER TO NAME (lcPrinter) syntax.

--
Fred
Microsoft Visual FoxPro MVP


"benjamin" <dwight...@state.mn.us> wrote in message
news:56b4b6f6-c523-4be4...@s1g2000pra.googlegroups.com...

Fred Taylor

unread,
Sep 4, 2008, 12:20:46 PM9/4/08
to
Also, since you're using a report, you may need to remove any printer
specific information from the report form itself. Open the report form as a
table with USE (USE myform.frx), and blank out the memo fields EXPR, TAG and
TAG2 fields for the first record only.

--
Fred
Microsoft Visual FoxPro MVP


"Fred Taylor" <fta...@mvps.org!REMOVE> wrote in message
news:uit97iiD...@TK2MSFTNGP02.phx.gbl...

Juan Alonso

unread,
Nov 6, 2008, 11:00:19 AM11/6/08
to
Fred,

Good morning.

I have the same problem.

My printers are set in a Novell Netware environment.

I have tryed to do this SET PRINTER TO NAME (network name/printer name)
syntax.
but it don't work. I can see my printers through Windows Netware
Connections in My Network Connections, but nothing. I can't get it to do it.

The workstations only have an install of the VFP libraries and support files
to run my programs, but VFP is not installed on them.

The old program, which was in Foxpro Dos 2.6a, uses the CAPTURE/ END CAPTURE
to change printers depending on where invoices are shipped to, but I can't
use it with Windows XP.. it always conflicts with it. Windows 2000 Pro is
ok with it, but not XP.

I thought about changing to NET USE commands, but I rather use the SET
PRINTER TO NAME command.

Let me know if there is something I might be missing that might be causing
me not to be able to do it.

Thanks in advance and if there is any additional information you want,
please let me know..

Juan.

"Fred Taylor" <fta...@mvps.org!REMOVE> wrote in message
news:uit97iiD...@TK2MSFTNGP02.phx.gbl...

Juan Alonso

unread,
Nov 6, 2008, 11:29:36 AM11/6/08
to
Never mind Fred, and thank you anyway.

I figured it out.

I have to install each Netware Printer on the local system for it to work.

Later,

Juan.

"Juan Alonso" <jo...@npdlink.com> wrote in message
news:%23HuEJjC...@TK2MSFTNGP06.phx.gbl...

Fred Taylor

unread,
Nov 6, 2008, 7:13:02 PM11/6/08
to
Glad you got it sorted out, because I haven't had to deal with Netware in
more than a decade. IIRC, the SET PRINTER TO NAME worked fine as long as
the name matched correctly.

--
Fred

"Juan Alonso" <jo...@npdlink.com> wrote in message

news:O0ntfzCQ...@TK2MSFTNGP02.phx.gbl...

Henry

unread,
Dec 23, 2008, 8:02:07 PM12/23/08
to
Hi. I did exactly this same thing as a quick and cheap way to print to
PDFs. One thing to be aware of - the printer driver name is case-sensitive.
If you do something like = APRINTER(laMyArray) and then give the command
DISPLAY MEMORY LIKE laMyArray, the first element in each row
will be the name of the printer driver.

You might want to do something like this:

= APRINTERS(laPrintArray )

IF ASCAN(laPrintArray, "Adobe PDF") > 0
SET PRINTER TO NAME "adobe pdf"
REPORT FORM <your report name> TO PRINTER NOCONSOLE NODIALOG
SET PRINTER TO DEFAULT
ELSE
REPORT FORM <your report name> TO PRINTER NOCONSOLE NODIALOG
ENDIF

This worked for me on the job very nicely. One of the key things you
may be missing is the SET PRINTER TO NAME (<your driver name>)

You may have to play with this a bit to adapt it to your exact setup,
but it should put you in the ballpark. Good luck.

Kam

unread,
Jan 14, 2009, 11:23:01 PM1/14/09
to
Henry,
I had a old program working on Adobe 5.0

SET PRINTER TO NAME "adobe pdf"
REPORT FORM <your report name> TO file outFileName
SET PRINTER TO DEFAULT

In your code, I don't know how you can specific the filename.

My code work well at Adobe 5.
In Adobe 7 or Adobe 9, It will create the TXT file, then I need to manually
ope the distiller to convert the file into pdf.

Do you know how to convert it to PDF automatically within VFP 9?

Sunny

unread,
Feb 25, 2009, 2:39:54 PM2/25/09
to
How do I add output file name and path? I use the following command and it
did something but I dont know where the output pdf is being stored?


"Henry" <gree...@optonline.net> wrote in message
news:49518a0f$0$20279$607e...@cv.net...

0 new messages