Joy Conner
7th January 2013, 22:38
I have used VB.net to execute sessions in BaaN but my current project has me stumped. My factory has requested 2 production order layouts. One will print on 8.5 x 11 paper using a portrait orientation. The other layout prints on 5.5 x 8.5 using landscape orientation.

All production orders will use BWPrint. And BWprint uses windows default printer and it's default settings. I think I have this right. We are getting ready to migrate from UNIX to Windows platform, so I don't have any automation with bwprint right now. This is my first.

When production orders are printed, user must change default print settings to portrait, the program prints all orders which are to be portrait. When this finishes, user must change paper size and set landscape orientation and run the program again to print all orders which are landscape.

My challenge is to automate this so user does not have to change default printer settings and so this can be a scheduled execution. Currently we print production orders every 15 minutes using UNIX cron. After our migration to Windows platform, UNIX crons will no longer be an option for me.

I have VS2010. Does anyone know how to change default printer settings? Or whether this is feasible?

As always, thanks in advance for any assistance.

- Joy Conner

benito
7th January 2013, 22:58
joy, i don't program in VB.net but it seems you can accomplish this in LN with two devices, never mind bwprint. just create a small print script and pass the two devices name.

-ben

Joy Conner
7th January 2013, 23:46
I'm in Baan4 environment and I'm told that BWPrint uses what ever settings are in default printer. So when you print a portrait report and default orientation is portrait, the printed report is fine. However, after printing the portrait report, user prints a landscape report, the printed report is NOT fine. It prints a landscape layout on a portrait orientation. Users first must preview output and change orientation of printer before sending to printer.

Maybe something has changed in new SP, but this has been my experience. We are on SP19.

benito
7th January 2013, 23:58
below is an example. please see the function get.printername(). you can have another device and depending on your conditions you can reprint.


long brp_id

|****************************** FORM SECTION ***************************
form.1:
init.form:
execute(print.data)

|****************************** CHOICE SECTION ***************************

choice.print.data:
on.choice:
spool.report = "rbfitm0401m0011"
get.printername()

brp_id = brp.open(spool.report, spool.device,0)
if brp_id > 0 then
read.main.table()
brp.close(brp_id)
else
choice.again()
endif

after.choice:
execute(end.program)

|****************************** FUNCTION SECTION ***************************
functions:

function read.main.table()
{
<select statement>
selectdo
brp.ready(brp_id)
endselect

}

function get.printername()
{
select bfitm002.prtr
from bfitm002
as set with 1 rows
selectdo
spool.device = bfitm002.prtr
endselect
}