Description

The INIT message must be called before any printing can start. The INIT message controls the initial properties for each printing session. Every INIT message must have a matching TERM message.

Parameters

ParameterDescription of FieldsCommentsDefault
Parm1 - FileName<1> FileNameProcess FileName"Printing"
 <2> Load RTFRTF filename to load""
 <3> Export Format

0 = No export

1 = RTF

2 = HTML

3 = DHTML

4 = HTML with pages

5 = DHTML with pages

6 = PDF

7 = CSV with header

8 = CSV without header

9 = TXT file

10 = OIPI Print File

11 = Archive Reports

0
 <4> Export File NameFile name for the export or Archive Name""
 <5, 1> PDF Owner passwordNote: Applies to OIPI.Net only with Patch v4 or higher.

Password that allows permission changes to the PDF document.

""
 <5, 2> PDF User passwordNote: Applies to OIPI.Net only with Patch v4 or higher.

Password that only allows the opening of the PDF document.

""
 <5, 3> PDF PermissionsNote: Applies to OIPI.Net only with Patch v4 or higher.

String of single character flags that indicate what permissions are granted to the PDF document:

C = Copy

E = Edit

P = Print

A = Annotation Edit

""
Parm2 - Title<1> Print Title"Title String""Printing"
 <2> Preview TitleMust be an unique string"Print Preview"
 <3> Cancel Button TextUse "&" to underline a specific character"&Cancel"
 <4> Device TextThe first "%s" is printer name and the second "%s" is the port name"on the %s on %s"
 <5> Page TextThe "%d" is the current page number"Now Printing Page %d of"
Parm3 - PageInfo<1> LeftMarginLeft margin0.5
 <2> TopMarginTop margin0.5
 <3> RightMarginRight margin0.5
 <4> BottomMarginBottom margin0.5
 <5> PageWidthPage Width in inches8.5
 <6> PageHeightPage Height in inches11.0
 <7> PageSizeSee OIPRINT_EQUATES 
 <8> CopiesNumber of copies to print 
 <9> Shortcuts

0=None

1=Copy to clipboard

0
Parm4 - PageSetup<1> Orientation

0=Port

1=Land

""
 <2> Units

1=Inches

2=Mm

3=cm

4=twips

5=points

 
 <3, 1> Export Top NavigationCustomizes the navigation at the top of the exported pages""
 <3, 2> Export Bottom NavigationCustomizes the navigation at the bottom of the exported pages""
 <4, 1> ColumnsNumber of columns in the report 
 <4, 2> ColumnSpacingSpacing between columns0.125
Parm5 - PrintSetup<1, 1> Style

0=Print to printer

1=Display PrintSetup

2=Preview normal

3=Maximized

4=Last location

5=Specific location

99=Print to printer with the WMF Fix.

0
 <1, 2> Buttons

0=Display All Buttons

1=Display Print Setup Button Only

2=Display Print Button Only

3=Hide All Buttons

4=Display PDF Button Only

5=Display Print and PDF Buttons

6=Display Print and Print Setup Buttons

2
 <1, 3> Hide0=Display

1=Hide the Printing Window

0
 <1, 4> StartMode

0=Normal

1=Minimized

2=Hidden

3=Completely Hidden

0
 <1, 5> AllowPageRange

0=No Page Range

1=Page Range Dialog Box

0
 <1, 6> Mouse Support

0=No support

1=Mouse

2=Mouse wheel

3=Mouse and wheel

4=Keyboard

5=Mouse and keyboard

6=Wheel and keyboard

7=All

0
 <2> Zoom

>0=Zoom

-1=Page Width

-2=Whole Page

100
 <3> SpecificX1to 100%0
 <4> SpecificY1to 100%0
 <5> SpecificX2to 100%0
 <6> SpecificY2to 100%0
 <7> Duplex

1= Simplex

2=Horizontal Duplex

3= Vertical Duplex

1
 <8> Hidden Export FormatsExport Format. When the Export Formats window is launched from the Preview window, it is possible to disable the export to specific formats.

Set the specific values to 1 within this parameter to disable the format.

Note: Applies to OpenInsight Versions 8.0 and above.

""
 <8,1>PDFSet to 1 to disable option.""
 <8,2>RTFSet to 1 to disable option.""
 <8,3> Save ReportSet to 1 to disable option.""
 <8,4> Load ReportSet to 1 to disable option.""
 <8,5> CSVSet to 1 to disable option.""
 <8,6> ArchiveSet to 1 to disable option.""
 <8,7> N/AN/A""
 <8,8> HTMLSet to 1 to disable option.""
 <9>BackcolorPreview window background color. An RGB number is expected.""
Parm6 - Printer<1,1> DeviceDevice String""
 <1,2> Default PrinterBoolean.

When set to true the Windows default printer will be changed to the printer specified in the Device parameter.

""
 <2> PortPort String""
 <3> ScaleOutputScales the output to the printer100
 <4> BinBin Number""
Parm7 - CharMapCharMap510 bytes""
Parm8 - Image Display In the Preview window, custom images may be used for the icons on the OIPI standard buttons.

Note: Applies to OpenInsight Versions 8.0 and above.

 
 <1,1>Print Dialog Button""
 <1,2>Print Button""
 <1,3>Export Format Button""
 <1,4>First Page Arrow Button""
 <1,5>Prev Page Arrow Button""
 <1,6>Next Page Arrow Button""
 <1,7>Last Page Arrow Button""
 <1,8>FInd Button""
 <1,9>Close Button""
Parm9 - Pagebreak Programs Stored Procedures to call prior to and after the printer control executes its Pagebreak.

Note: Applies to OpenInsight Versions 8.0.2 and above.

 
 <1,1>The name of the program to execute prior to the printer control executing a page break.""
 <1,2>The name of the program to execute after the printer control executes a page break.""

Remarks

The FileName parameter is printed in the header and footer when the 'F' code is used, and it is used to identify the print job from the Printer Manager. If you are using OIPI.Net with Patch v4, then you can use the PDF password and permissions options. Here is an example of what the FileName parameter might look like using the PDF enhancements:

parm1<1> = "Report 1"
parm1<3> = 6
parm1<4> = "c:\temp\samplepdf.pdf"
parm1<5> = "bzs":@VM:"bryan":@VM:"EC"

This specifies the title is “Report 1”, I wish to generate a PDF (type 6), the PDF name is “c:\temp\samplepdf.pdf”, and it has a PDF owner’s password of “bzs”, a PDF user’s password of “bryan”, and both Edit and Copy permissions are granted.

The Print Title parameter is used to change the title of the Printing dialog box. The Preview Title parameter is used to change the default title of the Print Preview window. The Cancel Button, Device, and Page Text control the labels on the Printing window that is displayed during printing (see the window below).

The margin parameters are used to set the margins. The default margins are 0.5 inch.

The PageWidth, PageHeight, and PageSize parameters are used to set the page height and width for the current printing session. When you want to set the page size to a pre-defined page size, then you must set the PageSize parameter to one of the page size values that is specified in the OIPRINT_EQUATES, and the PageWidth and PageHeight parameters must be NULL. To set the page size to a custom page size, the Get_Printer PAGESIZE message must return the 256 code. Then you can set the PageWidth and PageHeight to any custom page size. If the PageWidth and PageHeight are set, then the PageSize is ignored. For the best results you should set the PageSize parameter equal to an available page size code that was returned by the Get_Printer PAGESIZE message, and set the PageWidth and PageHeight to NULL. Always check the return code from the INIT message, because not all printers support custom page sizes. The PageHeight, PageWidth, and PageSize parameters are dependent on the current printer driver, and not all printer drivers allow custom page sizes. You should always use the most current version of the Windows printer driver. The Get_Printer PAGESIZES message returns all of the available page sizes for the current printer.

The Copies parameter is used to print multiple copies of the report. Before using the Copies parameter you should check the Get_Printer("SUPPORTCOPIES") message. INIT will return a -17 if your printer does not support Copies.

The Shortcuts parameter is used to enable the Print Preview Shortcuts. When you set the Shortcuts parameter to 1, the end user can use the Ctrl-C shortcut to copy the current page to the clipboard.

Set the Orientation parameter to 1 to print in landscape mode, and 0 to print in portrait mode. If the Orientation is NULL, then the current orientation is used.

The Units parameter determines what units are use by the Set_Printer and Get_Printer functions. The twips units are the smallest units used be the OIPI. One inch is equal to 1440 twips, and 1 point is equal to 20 twips.

The Style parameter determines if the report is sent directly to the printer or to the Print Preview window, or if the Printer Setup dialog is displayed before printing the report to the printer. If the Style parameter is set larger than 1, then the Print Preview window will be displayed. If the Style is 2, then the Print Preview window will be displayed at the default location and size. If the Style is 3, then the Print Preview window will start maximized. If the Style is 4, then the Print Preview window will be displayed at the last location and size that is stored in the OIPI.INI file. If the Style is 5, then the Print Preview window will start displayed at the SpecificX and SpecificY location.

The Buttons parameter is used to control which buttons are visible in the Print Preview window. You should not display the Printer Setup button in the Print Preview window, because any changes to the printer setup that are made after the Print Preview window is displayed will not take affect until the next printing session is started.

The Hide parameter is used to hide the Printing Window so you can use the Get_Printer function to obtain information without printing a report. If you do not print anything and only use the Get_Printer function, then you can hide the Printing Window from showing and use an INIT message with no parameters followed by Get_Printer function calls and finally a TERM message to end the printing session and nothing will print and nothing will be displayed.

The StartMode parameter is used to specify the starting mode for the Print Preview window. You can start the Print Preview window minimized, hidden, or completely hidden. Then when the TERM message is used to end the report, the Print Preview window is be displayed according to the setting in the Style parameter. You can use the parameter to hide the Print Preview window until the report is completed so you can display a status bar while printing and give the use the ability to stop printing the report with your own user interface. The Completely Hidden mode is useful when exporting files.

The AllowPageRange parameter is used to show the Print Range dialog box. If AllowPageRange is 1, then the Print button in the Preview window will display the Print Range dialog box. The Print Range dialog box allows the user to select a page range to print. The default behavior is to print the entire report when the Print button is clicked.

The Zoom parameter is used to set the initial zoom factor for the Print Preview window. The zoom for the Print Preview window is set to the value of Zoom, if Zoom is larger than zero. If Zoom is -1 then the initial zoom for the Print Preview window is set to Page Width, and if the Zoom is -2 then the initial zoom is set to Whole Page.

The Printer parameter is used to set the output to a specific printer without using the Printer Setup dialog box. The Device is the device for the specific printer. Use the Get_Printer DEVICES message to obtain a list of valid devices. To control which port you want to print to set the Port parameter.

The CharMap parameter is similar to the OpenInsight bi-directional CHARMAP feature. If CharMap is not assigned or NULL, then this feature is disabled. This parameter must be a string that is 510 bytes long. The first 255 bytes are the Display values and the last 255 bytes are the Saved values. All Set_Printer messages will expect the Saved vales and will print the Display values. All Get_Printer messages will return data with the Saved values. If you wan the OIPI to use the same CHARMAP as OpenInsight, then set the OIPI CharMap field equal to Get_Property(“SYSTEM”, “CHARMAP”). The CharMap feature does not allow you to remap the TAB or CR characters.

The Load RTF parameter is used to specify a RTF file that is opened and displayed in the report. The Export Format parameter is used to save the report in RTF, HTML, DHTML, PDF, CSV, TXT or OIPI format. The HTML or DHTML with pages will export multiple pages with the navigation bars specified in the Export Top Navigation and Export Bottom Navigation parameters. The default navigation bar allows you to move first, move last, move next, and move previous. The Export Top Navigation and Export Bottom Navigation parameters must contain HTML with special codes for the first and previous pages (%s and %s), current page and last page (%d and %d, and next and last pages (%s and %s). The report is exported to the Export File Name file. The OIPI format allows a print job to be saved and viewed within OpenInsight. See the Examples below for use.

The ScaleOutput parameter is used to scale the output of the report when printing by a percentage between 1 and 200 percent (100 percent is normal). The parameter has does not change the output in the print preview, but the printed report will be scaled. This feature is dependent on the printer, and not all printers and printer drivers support this feature. The INIT message will return a -20 error code if the printer does not support scaling.

The Columns parameter is used to set the number of columns in the report. Setting this parameter to a value greater than 1 will place the output of TEXT messages into the specified number of columns. The ColumnSpacing parameter is used to adjust the spacing between columns.

The Mouse Support parameter is used to control the mouse, wheel, and keyboard navigation of the preview.

See also

Set_Printer("TERM")

Example

/* The following example shows how to use the INIT message to print a report to the Print Preview window. The report will be printed in landscape orientation with 0.5 inch margins. The size and position of the Print Preview window will be read from the OIPI.INI file. */
declare function Set_Printer
title = "Test":@FM:@FM
title := "Cancel Button"
title := "on the %s on %s":@FM
title := "Now Printing Page %d of Report":@FM
stat = Set_Printer("INIT", "Report 1", title, "", 1, 4)
stat = Set_Printer("TEXT", "Test 1 2 3")
stat = Set_Printer("TERM") ;* End printing
  • No labels