Simple Printing: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created page with "A '''PDF''' or '''Portable Document Format''' document (wikipedia:Portable Document Format) can be created with Business Rules! 4.2 and higher. This is not the same f...")
 
No edit summary
Line 1: Line 1:
A '''PDF''' or '''Portable Document Format''' document ([[wikipedia:Portable Document Format]]) can be created with Business Rules! [[4.2]] and higher.
In BR, printing to a printer has traditionally been controlled by the statement OPEN #255. This short sample program will demonstrate how to print:


This is not the same facility as [[NWP]]. However it supports all of the NWP syntax with the following exceptions:
00010 OPEN #255: "name=PREVIEW:/DEFAULT,recl 32000", DISPLAY,OUTPUT
00020 PRINT #255: "HELLO WORLD!"
00030 CLOSE #255:  


*Tiling and cross hatching are not supported. (colors and shading do work)
In the above example, '''PREVIEW''' will print to a preview window before sending it to the default printer. '''DEFAULT''' could be substituted with the name of a printer or SELECT to allow the user to choose which printer. '''Recl''' refers to record length and should be high, so that the printer does not perform an untimely carriage return.
*[[NORESIZE]] is ignored.  
*We are restricted to true type fonts only.


A couple of the more exciting characteristics of this new printing facility are the relatively compact output file sizes and the ability to overprint PDF forms.  
To format printing, [[PRINTER.SYS]] provides shortcuts to refer to the different styles and fonts available when printing. For example:


This feature requires the [[PDFLIB.DLL]] to be present in the BR directory.
00020 PRINT #255: "[BLUE]HELLO WORLD!"
00020 PRINT #255: "[TAHOMA]HELLO WORLD!"


To create a PDF file specify in the print file [[OPEN]] statement:
will print in blue, when Printer.sys is in the file and BRConfig.sys has the line "Include Printer.sys"
Name= PDF:/ [,PrintFile= ...]
If printfile is not specified, BR creates a PDF file in the [[spool directory]].


To create a PDF file and send it to the user’s Windows program associated with PDF files (such as Adobe Acrobat):
To print data from a file, simply add the variable names to the PRINT statement (after OPENing and READing the file of course), for example:
Name= PDF:/READER [,PrintFile= ...]
This is the same as creating a PDF file and then double clicking it.


To create a PDF file and send it to a specified program or batch file:
00030 PRINT #255: "NAME$"
Name= PDF:/program-name [,PrintFile= ...]


A background PDF file may be specified in the printed output as
An empty PRINT statement will skip lines, for example:
\Epdf='page_number,pdf-filename'.
As with similar NWP [[escape sequences]], \Epdf= is case sensitive, but the pdf-filename is not.
 
A [[CONFIG]] [[statement]] may override the default Windows PDF reader (typically Adobe Acrobat):
PDF_READER adobe-reader-alternate
This CONFIG statement causes BR to translate “Name= PDF:/READER” to
“Name=PDF:/adobe-reader-alternate”.


00500 PRINT #255: "Dear NAME$"
00510 PRINT #255:


<noinclude>
<noinclude>
[[Category:Printing]]
[[Category:Printing]]
[[Category:Terminology]]
</noinclude>
</noinclude>

Revision as of 19:16, 5 April 2013

In BR, printing to a printer has traditionally been controlled by the statement OPEN #255. This short sample program will demonstrate how to print:

00010 OPEN #255: "name=PREVIEW:/DEFAULT,recl 32000", DISPLAY,OUTPUT
00020 PRINT #255: "HELLO WORLD!"
00030 CLOSE #255: 

In the above example, PREVIEW will print to a preview window before sending it to the default printer. DEFAULT could be substituted with the name of a printer or SELECT to allow the user to choose which printer. Recl refers to record length and should be high, so that the printer does not perform an untimely carriage return.

To format printing, PRINTER.SYS provides shortcuts to refer to the different styles and fonts available when printing. For example:

00020 PRINT #255: "[BLUE]HELLO WORLD!" 
00020 PRINT #255: "[TAHOMA]HELLO WORLD!"

will print in blue, when Printer.sys is in the file and BRConfig.sys has the line "Include Printer.sys"

To print data from a file, simply add the variable names to the PRINT statement (after OPENing and READing the file of course), for example:

00030 PRINT #255: "NAME$" 

An empty PRINT statement will skip lines, for example:

00500 PRINT #255: "Dear NAME$"
00510 PRINT #255: