|
Home > Archive > Programming with dBASE > December 2006 > _pdriver problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Omar Mohammed 2006-12-11, 7:14 pm |
| Hi.
I either have a problem understanding the _pdriver or using it. I'm
using db2k 0.4.
Basically I have 3 reports. Each report uses a specific printer but it's
the same information (1 is formatted for laser, the other for a dot
matrix and the other for a colour inkjet).
What I did was create 3 buttons. Depending on the button pressed I use
the following code (ports.dbf is the name of the file that has the
printer's _pdriver string e.g. 'WINSPOOL,PDF995')
So let's say this is button 2 pressed
pdrv = new query()
pdrv.sql := "SELECT * FROM ports"
pdrv.active := true
pd = ltrim(rtrim(pdrv.rowset.fields["printer2_com"].value))
pdrv.active := false
release pdrv
_pdriver = pd
set procedure to report2.rep additive
inv = new report2report()
inv.output = 1
inv.render()
release inv
This would be button 1
pdrv = new query()
pdrv.sql := "SELECT * FROM ports"
pdrv.active := true
pd = ltrim(rtrim(pdrv.rowset.fields["printer1_com"].value))
pdrv.active := false
release pdrv
_pdriver = pd
set procedure to report1.rep additive
inv = new report1report()
inv.output = 1
inv.render()
release inv
When it is run the fist time it works ok
If I keep clicking the buttons, the correct REPORT is printed (e.g.
report1, 2 or 3) but it is sent to the wrong PRINTER.
Sometimes report1 gets sent to printer 2 or printer 3, and so on
Please advise what I'm doing wrong here.
At first all prints were going to the default printer but I removed the
with (this.printer) block
Also chooseprinter() may not work here since the users won't know which
report goes to which printer (they just want to select the report (1 2
or 3) and the program will 'know' what printer to choose.
I hope I was clear in explaining my problem
Regards
Omar
| |
| Ken Mayer [dBVIPS] 2006-12-11, 7:14 pm |
| Omar Mohammed wrote:
> Hi.
> I either have a problem understanding the _pdriver or using it. I'm
> using db2k 0.4.
>
> Basically I have 3 reports. Each report uses a specific printer but it's
> the same information (1 is formatted for laser, the other for a dot
> matrix and the other for a colour inkjet).
> What I did was create 3 buttons. Depending on the button pressed I use
> the following code (ports.dbf is the name of the file that has the
> printer's _pdriver string e.g. 'WINSPOOL,PDF995')
>
> So let's say this is button 2 pressed
>
> pdrv = new query()
> pdrv.sql := "SELECT * FROM ports"
> pdrv.active := true
> pd = ltrim(rtrim(pdrv.rowset.fields["printer2_com"].value))
> pdrv.active := false
> release pdrv
> _pdriver = pd
> set procedure to report2.rep additive
> inv = new report2report()
> inv.output = 1
> inv.render()
> release inv
>
> This would be button 1
>
> pdrv = new query()
> pdrv.sql := "SELECT * FROM ports"
> pdrv.active := true
> pd = ltrim(rtrim(pdrv.rowset.fields["printer1_com"].value))
> pdrv.active := false
> release pdrv
> _pdriver = pd
> set procedure to report1.rep additive
> inv = new report1report()
> inv.output = 1
> inv.render()
> release inv
>
> When it is run the fist time it works ok
> If I keep clicking the buttons, the correct REPORT is printed (e.g.
> report1, 2 or 3) but it is sent to the wrong PRINTER.
> Sometimes report1 gets sent to printer 2 or printer 3, and so on
>
> Please advise what I'm doing wrong here.
> At first all prints were going to the default printer but I removed the
> with (this.printer) block
> Also chooseprinter() may not work here since the users won't know which
> report goes to which printer (they just want to select the report (1 2
> or 3) and the program will 'know' what printer to choose.
>
> I hope I was clear in explaining my problem
> Regards
_PDRIVER does not work with the report engine. It works for streaming
output.
The old DOS way of setting printer drivers won't work with the dBASE
Report Engine.
If you're pulling printer info out of a table, you need to make sure you
are using the information that is recognized by Windows for the printer
driver name, which is usually the name that appears in the ChoosePrinter
dialog, whether you wish to use that or not.
Then, for the report:
// untested:
inv = new report1report()
inv.output = 1
inv.printer.printerName := pd
rinv.render()
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Omar Mohammed 2006-12-13, 7:12 pm |
| Thanks
I'm going to try this 1st thing in the morning and I'll let you know
Omar
Then, for the report:
// untested:
inv = new report1report()
inv.output = 1
inv.printer.printerName := pd
rinv.render()
Ken
|
|
|
|
|