[BR_forum] NWP Printing

Discussion about printing issues and techniques.

Moderators: Susan Smith, admin, Gabriel

Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] NWP Printing

Post by Gabriel »

Thinking about it, I realise you probably want the example in a proportional font, duh!

Here you go.

The program that generates this output (copy and pasted directly from my editor) is:

00001 open #1: "name=preview:/",display,output
00002 !
00003 print #1: "[Box][SetFont(Times)]"
00004 print #1: "|Here is my First | and second Columns|"
00005 print #1: "|My invoice grid | is easy to make |"
00006 print #1: "| with NWP because| I can see the |"
00007 print #1: "|Columns as they lineup with eachother|[BoxTop]"
00008 print #1: "|These two bottom rows have one big |[BoxBottom]"
00009 print #1: "|box |[/Box]"
00010 close #1:

Isn't it neat how you can draw your grid using pipe symbols (|) in the non-proportional font BR editor, and have it still line up perfectly in the proportional font real world? You'll notice I did not change any lines of this program except the font from my original example. Everything else worked fine on its own.

Gabriel



On Thu, Aug 21, 2008 at 9:25 AM, Gabriel Bakker <gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I just tested the example I gave and it produced the output in the attached files. I printed it to pdf, and I have attached the pdf. However, I also converted the pdf to a gif to make it easier to view if you want. I have attached both copies.

The bottom three rows have only one column each, however the grid still lines up.
The bottom two rows are really one big row, two high.

Isn't it easy to "draw" grids on your reports or invoices? The fact that cursor advances makes it even easier then in other languages. (It definitely doesn't advance arbitrarily.)

Gabriel



On Thu, Aug 21, 2008 at 9:14 AM, Gabriel Bakker <gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
The reason the cursor advances when you embed the | and [|] sequences is because Gordon wanted you to be able to draw your grids with |'s and have your grids just appear on the page the way you drew them.

[Box]
|Here is my First | and second Columns|
|My invoice grid | is easy to make |
| with NWP because| I can see the |
|Columns as they lineup with eachother|[BoxTop]
|These two bottom rows have one big |[BoxBottom]
|box |[/Box]


The goal was to make it so that you can draw your grids in the BR editor and they would magically work in your print jobs.

Gabriel



2008/8/21 Rickie Graham <rdgcss@attglobal.net (rdgcss@attglobal.net)>

As far as I tell the cursor has always advanced when embedding escape sequences or printer substitution into the print stream. An easy way to prove this is to open the printer with a short recl= and insert a bunch of printer substitution commands, you will get a line wrap (BR inserts a CRLF). As far as I can tell, this is because the printer substation doesn't occur until the printer stream leaves the print buffer, just before it is sent to the actual printer (Spooler).

Rick Graham


From: br_forum-bounces@maillist.ads.net (br_forum-bounces@maillist.ads.net) [mailto:br_forum-bounces@maillist.ads.net (br_forum-bounces@maillist.ads.net)] On Behalf Of david@masterstouch.net (david@masterstouch.net)
Sent: Thursday, August 21, 2008 12:02 AM

To: Business Rules Forum
Subject: Re: [BR_forum] NWP Printing








No, It aught to work but...

Your example had no absolute location for alignment. The "box" method is fine if you don't care where the text prints and you let Gordon do it. Try drawing some lines and position the text at a specific point. I hope this is just some more of "Gordon has no idea of what he is doing here" and he can and will fix it. When you send the printer an escape sequence (such as right justify) the cursor should not be advanced by the length of the command string! That is the way the real world works but not 4.18! The codes for left and right justify advance the cursor (different amounts and without apparent consistency)

When you position the cursor to print text, that is where the text should be printed but for the right and left justify to work, it must be immediately follow by the text to be impacted. The cursor has been advanced and the text (while right aligned) is to the right of where it should be. The result is you must "guess" at some point to the left of where the actual text should print, send the escape sequence and the text such that it hits in the right spot. This is very much a trial and error.

It is my hope that this can be resolved. Essentially any escape sequence (other than a position command) should execute without advancing the cursor, something like "[PUSH] escape seq [POP]". By the way this does not work even if you are willing to go to the trouble because the text must follow the command.

I get so frustrated trying to do "real" things with BR that is not ready for prime time (the above only works in 4.18!) When these "features" are added, they seem to be added as a band-aid instead of a planned implementation. It makes me think that the people writing the code have never tried to produce a true proportional font output - in any language!

I may try to write Gordon but my frustration is sure to come shining through.

David
-----Original Message-----
From: George Tisdale [mailto:GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)]
Sent: Wednesday, August 20, 2008 10:07 PM
To: 'Business Rules Forum'
Subject: RE: [BR_forum] NWP Printing
No, this is the last send and demonstrates the use of column alignment in NWP.

The program below uses to for next loops to print stuff to an NWP document.

The first one does so using a normal BR FORM statement, the second one is a bunch of text strung together with [|] separating the strings. Similar results, however in the second one the "X"s eventually exceed the field length and start pushing the column to the right - not what you want. So the first option is preferable using the form statement. You will need to play with the C values in the form statement to get your amounts in the right places. But it will work nicely.

George


From: br_forum-bounces@maillist.ads.net (br_forum-bounces@maillist.ads.net) [mailto:br_forum-bounces@maillist.ads.net (br_forum-bounces@maillist.ads.net)] On Behalf Of david@masterstouch.net (david@masterstouch.net)
Sent: Wednesday, August 20, 2008 9:29 PM
To: Business Rules Forum
Subject: Re: [BR_forum] NWP Printing
I was pretty sure you sent me something after the email below but I must have inadvertently deleted it. This is the first chance I have had to work on this program since Monday night late. If you did sent one after this one (below), could you re-send it?

Thanks.

David







No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.6/1625 - Release Date: 8/21/2008 6:04 AM


_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net (BR_forum@maillist.ads.net)
http://maillist.ads.net/mailman/listinfo/br_forum











Post generated using Mail2Forum (http://www.mail2forum.com)
kevin at wcs.ab.ca

[BR_forum] NWP Printing

Post by kevin at wcs.ab.ca »

As another option, don't forget that the decipos command is available.
I found it easier in some situations to draw the grid first, then reset
the cursor and print the contents second. I find that it also makes the
code more readable in a lot of cases, since you can print each "section"
completely before moving on to the next one.

Gabriel Bakker wrote:
Thinking about it, I realise you probably want the example in a
proportional font, duh!

Here you go.

The program that generates this output (copy and pasted directly from
my editor) is:

00001 open #1: "name=preview:/",display,output
00002 !
00003 print #1: "[Box][SetFont(Times)]"
00004 print #1: "|Here is my First | and second Columns|"
00005 print #1: "|My invoice grid | is easy to make |"
00006 print #1: "| with NWP because| I can see the |"
00007 print #1: "|Columns as they lineup with eachother|[BoxTop]"
00008 print #1: "|These two bottom rows have one big |[BoxBottom]"
00009 print #1: "|box |[/Box]"
00010 close #1:
Isn't it neat how you can draw your grid using pipe symbols (|) in the
non-proportional font BR editor, and have it still line up perfectly
in the proportional font real world? You'll notice I did not change
any lines of this program except the font from my original example.
Everything else worked fine on its own.

Gabriel



On Thu, Aug 21, 2008 at 9:25 AM, Gabriel Bakker
<gabriel.bakker@gmail.com <mailto:gabriel.bakker@gmail.com>> wrote:

I just tested the example I gave and it produced the output in the
attached files. I printed it to pdf, and I have attached the pdf.
However, I also converted the pdf to a gif to make it easier to
view if you want. I have attached both copies.

The bottom three rows have only one column each, however the grid
still lines up.
The bottom two rows are really one big row, two high.

Isn't it easy to "draw" grids on your reports or invoices? The
fact that cursor advances makes it even easier then in other
languages. (It definitely doesn't advance arbitrarily.)

Gabriel

On Thu, Aug 21, 2008 at 9:14 AM, Gabriel Bakker
<gabriel.bakker@gmail.com <mailto:gabriel.bakker@gmail.com>> wrote:

The reason the cursor advances when you embed the | and [|]
sequences is because Gordon wanted you to be able to draw your
grids with |'s and have your grids just appear on the page the
way you drew them.

[Box]
|Here is my First | and second Columns|
|My invoice grid | is easy to make |
| with NWP because| I can see the |
|Columns as they lineup with eachother|[BoxTop]
|These two bottom rows have one big |[BoxBottom]
|box |[/Box]


The goal was to make it so that you can draw your grids in the
BR editor and they would magically work in your print jobs.

Gabriel


2008/8/21 Rickie Graham <rdgcss@attglobal.net
<mailto:rdgcss@attglobal.net>>

As far as I tell the cursor has always advanced when
embedding escape sequences or printer substitution into
the print stream. An easy way to prove this is to open
the printer with a short recl= and insert a bunch of
printer substitution commands, you will get a line wrap
(BR inserts a CRLF). As far as I can tell, this is because
the printer substation doesn't occur until the printer
stream leaves the print buffer, just before it is sent to
the actual printer (Spooler).



Rick Graham



------------------------------------------------------------------------

*From:* br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>
[mailto:br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>] *On Behalf Of
*david@masterstouch.net <mailto:david@masterstouch.net>
*Sent:* Thursday, August 21, 2008 12:02 AM

*To:* Business Rules Forum
*Subject:* Re: [BR_forum] NWP Printing



*No, It aught to work *but...

Your example had no absolute location for alignment. The
"box" method is fine if you don't care where the text
prints and you let Gordon do it. Try drawing some lines
and position the text at a specific point. I hope this is
just some more of "Gordon has no idea of what he is doing
here" and he can and will fix it. When you send the
printer an escape sequence (such as right justify) the
cursor should not be advanced by the length of the command
string! That is the way the real world works but not
4.18! The codes for left and right justify advance the
cursor (different amounts and without apparent consistency)

When you position the cursor to print text, that is where
the text should be printed but for the right and left
justify to work, it must be immediately follow by the text
to be impacted. The cursor has been advanced and the text
(while right aligned) is to the right of where it should
be. The result is you must "guess" at some point to the
left of where the actual text should print, send the
escape sequence and the text such that it hits in the
right spot. This is very much a trial and error.

It is my hope that this can be resolved. Essentially any
escape sequence (other than a position command) should
execute without advancing the cursor, something like
"[PUSH] escape seq [POP]". By the way this does not work
even if you are willing to go to the trouble because the
text must follow the command.

I get so frustrated trying to do "real" things with BR
that is not ready for prime time (the above only works in
4.18!) When these "features" are added, they seem to be
added as a band-aid instead of a planned implementation.
It makes me think that the people writing the code have
never tried to produce a true proportional font output -
in any language!

I may try to write Gordon but my frustration is sure to
come shining through.

David

-----Original Message-----
*From:* George Tisdale [mailto:GTISDALE@tisdalecpa.com
<mailto:GTISDALE@tisdalecpa.com>]
*Sent:* Wednesday, August 20, 2008 10:07 PM
*To:* 'Business Rules Forum'
*Subject:* RE: [BR_forum] NWP Printing

No, this is the last send and demonstrates the use of
column alignment in NWP.



The program below uses to for next loops to print stuff to
an NWP document.



The first one does so using a normal BR FORM statement,
the second one is a bunch of text strung together with [|]
separating the strings. Similar results, however in the
second one the "X"s eventually exceed the field length and
start pushing the column to the right - not what you
want. So the first option is preferable using the form
statement. You will need to play with the C values in the
form statement to get your amounts in the right places.
But it will work nicely.



George



------------------------------------------------------------------------

*From:* br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>
[mailto:br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>] *On Behalf Of
*david@masterstouch.net <mailto:david@masterstouch.net>
*Sent:* Wednesday, August 20, 2008 9:29 PM
*To:* Business Rules Forum
*Subject:* Re: [BR_forum] NWP Printing

I was pretty sure you sent me something after the email
below but I must have inadvertently deleted it. This is
the first chance I have had to work on this program since
Monday night late. If you did sent one after this one
(below), could you re-send it?

Thanks.

David



-----Original Message-----
*From:* George Tisdale [mailto:GTISDALE@tisdalecpa.com
<mailto:GTISDALE@tisdalecpa.com>]
*Sent:* Tuesday, August 19, 2008 02:58 PM
*To:* 'Business Rules Forum'
*Subject:* RE: [BR_forum] NWP Printing

Decimals do not align.



You need to right justify the field and make sure the
number of decimal places in the string (not number) is
consistent.



Thank you for the [BOXVETICALS] without the [BOX]
command. That and the [|] (bracket bar bracket)
removes the visible boxes.



00090 LET LEFT$=CHR$(27)&"left_justify" !:
LET RIGHT$=CHR$(27)&"right_justify"
00100 OPEN #10:
"name=PREVIEW:/SELECT,eol=none",DISPLAY, OUTPUT
00110 EXECUTE "PROC *:vol002\tt"
00120 LIBRARY ENV$("PD")&"vol002\fnsnap.dll":
FNPRINTBOX,FNDRAWBOX


00130 LET V=0 : LET H=0: LET BV=10.0 : LET BH=8.00 :
LET WEIGHT=0.01 : LET SHADE=0
00140 LET FNDRAWBOX(10,V,H,BV,BH,WEIGHT,SHADE)

00150 PRINT #10: CRLF$


00160 PRINT #10: "[BOXVERTICALS][SETFONT(ARIAL)]"


00170 FOR A=1 TO 20
00180 PRINT #10,USING 'Form c 65,"[|]",c 8,"[|]",c
30,c 2': LEFT$&"This is the way we wash our
clothes","ABCD",RIGHT$&CNVRT$("pic(---,--#.##)",A*100),CRLF$
00190 NEXT A


00200 FOR A=1 TO 20
00210 PRINT #10: CHR$(27)&"left_justify"&RPAD$("This
is the way we wash our clothes "&RPT$("X",A),50)&"[|]
ABC
[|]"&CHR$(27)&"right_justify"&CNVRT$("pic(---,--#.##)",A*100)&CRLF$
00220 NEXT A

This now works in two different ways .



Thanks Gabriel.



*George L. Tisdale, CPA*
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with
requirements imposed by the IRS, we inform you that
any U.S. tax advice contained in this communication
(including any attachments) is not intended or written
to be used, and cannot be used, for the purpose of (i)
avoiding penalties under the Internal Revenue Code or
(ii) promoting, marketing or recommending to another
party any transaction or matter addressed herein."

This electronic message transmission contains
information which is intended only for the use of the
individual or entity to which it is addressed and may
contain information that is privileged, confidential
and exempt from disclosure under applicable law. If
the reader of this message is not the intended
recipient, you are hereby notified that any
dissemination or distribution of this communication to
other than the intended recipient is strictly
prohibited. If you have received this communication in
error, please notify us immediately by calling (978)
369-5585 or by electronic mail
(gtisdale@tisdalecpa.com
<mailto:gtisdale@tisdalecpa.com>) Thank you.





------------------------------------------------------------------------

*From:* br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>
[mailto:br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>] *On
Behalf Of *Gabriel Bakker
*Sent:* 08/19/2008 1:18 PM
*To:* Business Rules Forum
*Subject:* Re: [BR_forum] NWP Printing

You can draw boxes without words by turning
boxmode on and printing spaces, just like you said.



PRINT #255: "[BOX]| |[/BOX]"



And it will print an empty box.



If you want the box to be more rows tall you just
need to say:



PRINT #255:
"[BOXTOP]| |"

PRINT
#255: "[BOXVERTICALS]|
|"

PRINT #255:
"[BOXBOTTOMS]|
|[/BOX]"



And it will print an empty box which is 3 rows tall.



If you want to use the boxing commands without
actually printing boxes you can say:



PRINT #255: "[BOXVERTICALS][|] Print anything
you want [|][/BOX].





Remember that each of these commands is listed in
my email using the printer.sys substitutions. You
can also accomplish the same thing without using
printer.sys by just giving the NWP commands
themselves.



[BOX] = Chr$(13) & "begin_box"

[/BOX] = Chr$(13) & "end_box"

[BOXTOP] = Chr$(13) & "begin_boxtop"

[BOXBOTTOM] = Chr$(13) & "begin_boxbottom"

[BOXVERTICALS] = Chr$(13) & "begin_boxverticals"

= hex$(05)



Also notice the pipe symbols in the above example
code ("|"). These pipe symbols tell BR where to
make the Vertical line parts of the box.



You can also make an invisible column separator by
using . This is useful when you want some of
the box features like right justify, but you don't
want any boxes to appear.



If you use the [BOXVERTICALS] command and you
don't specify any "|" pipe symbol box sides, then
BR will use all the box features without printing
any boxes.



Think of it like turning Box mode on but turning
all the display attributes of Box mode off (tops,
bottoms, and no sides if you don't print |s.



You can use the \Eright justify command when you
are in box mode. It will right justify your text
in the boxes you are printing, and it should line
up the decimal points if you are printing numbers.
At least I'm pretty sure it will if they each have
the same amount of significant digits, but it may
even line up the decimal points no matter how many
significant digits your numbers have.



You can download the latest copy of printer.sys
(the one used at the Spring 08 conference) here:



ftp://dsg.ftpaccess.cc/Sage/printer.sys/printer.sys

ftp://dsg.ftpaccess.cc/Sage/printer.sys/printer.sys.doc



Look in printer.sys.doc at the section on Page 8
titled "Boxing".



This version of printer.sys hasn't changed since
probably 2006 sometime so if you have an older
copy, I don't think it will be any different from
this one.



Boxing has been in printer.sys since the beginning.





Gabriel





2008/8/19 George Tisdale <GTISDALE@tisdalecpa.com
<mailto:GTISDALE@tisdalecpa.com>>

00010 OPEN #10:
"name=PREVIEW:/SELECT,eol=none",DISPLAY, OUTPUT
00020 EXECUTE "PROC *:vol002\tt"
00030 LIBRARY ENV$("PD")&"vol002\fnsnap.dll":
FNPRINTBOX,FNDRAWBOX
00040 LET V=0 : LET H=0: LET BV=10.0 : LET BH=8.00
: LET WEIGHT=0.01 : LET SHADE=0
00050 LET FNDRAWBOX(10,V,H,BV,BH,WEIGHT,SHADE)
00060 PRINT #10: CRLF$
00070 PRINT #10: "[BOX][SETFONT(ARIAL)]"
00080 FOR A=1 TO 20
00090 PRINT #10,USING "Form c 50,c 8,cr 12": "This
is the way we wash our
clothes","ABCD",CNVRT$("pic(---,--#.00)",A*100)&CRLF$
00100 NEXT A
00110 FOR A=1 TO 20
00120 PRINT #10:
CHR$(27)&"left_justify"&RPAD$("This is the way we
wash our clothes "&RPT$("X",A),50)&"| ABC
|"&CHR$(27)&"right_justify"&CNVRT$("pic(---,--#.##)",A*100)&CRLF$
00130 NEXT A





The above will demonstrate the difference between
straight printing in NWP (4.18) using proportional
fonts and using boxes with proportional fonts.
Note that the boxes are set by the length of the
data printed to them and so padding that data will
allow the boxes to align. When the data exceeds
the box length then the box expands.



I do not know how to achieve this box treatment
without the boxes showing. That would be a
requirement for most reports, invoices statements
etc. Perhaps someone else can state that . The
only reason that FNSNAP is in the above example is
to draw a box around the outside of the example
that is separate from the boxes in the table.



*George L. Tisdale, CPA*
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance
with requirements imposed by the IRS, we inform
you that any U.S. tax advice contained in this
communication (including any attachments) is not
intended or written to be used, and cannot be
used, for the purpose of (i) avoiding penalties
under the Internal Revenue Code or (ii) promoting,
marketing or recommending to another party any
transaction or matter addressed herein."

This electronic message transmission contains
information which is intended only for the use of
the individual or entity to which it is addressed
and may contain information that is privileged,
confidential and exempt from disclosure under
applicable law. If the reader of this message is
not the intended recipient, you are hereby
notified that any dissemination or distribution of
this communication to other than the intended
recipient is strictly prohibited. If you have
received this communication in error, please
notify us immediately by calling (978) 369-5585 or
by electronic mail (gtisdale@tisdalecpa.com
<mailto:gtisdale@tisdalecpa.com>) Thank you.





------------------------------------------------------------------------

*From:* br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>
[mailto:br_forum-bounces@maillist.ads.net
<mailto:br_forum-bounces@maillist.ads.net>]
*On Behalf Of *david@masterstouch.net
<mailto:david@masterstouch.net>
*Sent:* 08/18/2008 10:46 PM
*To:* br_forum@maillist.ads.net
<mailto:br_forum@maillist.ads.net>
*Subject:* [BR_forum] NWP Printing

I have been working to convert my applications
to 4.17. To meet a specific requirement
(emailed statements to be demonstrated at the
Fall conference), I need to print a report
with a column of decimal aligned numbers
(Arial font). I have _not_ gotten this to
work. I have tried right justified text from
cnvrt$ etc to no avail.

If anyone has resolved this issue, please post.

Secondly, print preview allows you to print a
single page or the entire document. It should
also provide the means to print a range of
pages (Pages 35-60 of 400).

I have tried the latest 4.18 version without
success.

The release indicates support for
\Eright_justify but there are no examples of
how to implement this either. Again, if you
have a solution, please post it.

David Blankenship


_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net
<mailto:BR_forum@maillist.ads.net>
http://maillist.ads.net/mailman/listinfo/br_forum





No virus found in this incoming message.
Checked by AVG - http://www.avg.com <http://www.avg.com/>
Version: 8.0.138 / Virus Database: 270.6.6/1625 - Release
Date: 8/21/2008 6:04 AM


_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net <mailto:BR_forum@maillist.ads.net>
http://maillist.ads.net/mailman/listinfo/br_forum





------------------------------------------------------------------------

------------------------------------------------------------------------

_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net
http://maillist.ads.net/mailman/listinfo/br_forum


--
Kevin Klappstein
Western Canadian Software
kevin@wcs.ab.ca

_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net
http://maillist.ads.net/mailman/listinfo/br_forum

Post generated using Mail2Forum (http://www.mail2forum.com)
Post Reply