General Demo Explanation

See the result for this sample
See the code to generate this sample

Line 1 The programmer can choose which of the export formats are offered to the end user, avoiding those which may not display well with particular methods.

Line 2 The parameters specify the margins which, in turn, define the inside frame. Optionally either or both header and footer frames may be defined. In this case only the header is created.

Line 3 The page size is the dimension of the area within which the print is to be created. Later, the programmer or the end user may decide which size paper is used, depending on available printers.

Line 4 The various frames can be modified or added later - in this case the footer is added.

Line 5 The inside frame is selected by default so the font is set for that frame.

Line 6 Page number can be either in Arabic or roman numerals.

Line 7 In order to display inside the header frame, it must first be selected as the current frame.

Lines 8 & 9 Frames may optionally have the outside border drawn or left blank.

Line 10 AddTextAt is the simplest text method. With no other parameters than the text string, it uses the current position - here still at the frame origin - and defaults for other parameters. The values of curreny x and y are updated so further calls print on successive lines.

Line 11 ParaText is a more powerful text method that prints text inside a notional rectangle, using embedded commands to determine formatting options. In this case <ce> causes the text lines to be centered whilst <pg> inserts the current page number.

Line 12 DrawPicture reads an external file and scales the picture to fit within the specified rectangle. By using prSTExternal, the picture is not stored as part of the document but read in whenever needed.

Line 13 Now the footer frame is selected for printing.

Lines 14 & 15 Draw the outline of the footer in green.

Line 16 This line adds a PageNumber element to the footer frame. By using this element type, if the frame is copied to another page then it displays the corresponding page number, whilst <pg> in ParaText uses the page number at the time the text is flowed.

Line 17 Now we return to the main inside frame.

Line 18 The next 18 lines add various samples of elements. The line width is first set. The parameter is in twips but, as with all PrintPreview dimension parameters, a string value is converted based on the type of dimension specified, in this case points.

Line 19 A line is drawn - the same method draws rectangles but the default is line.

Line 20 Drawing a circle is based on the center point and radius. In this case the dimensions are specified in inches.

Lines 21-23 PrintPreview provides a number of symbols which it draw at the specified location and the given overall size. In some cases, such as CheckBox, a parameter is used to modify the appearance. With CheckBox the parameter is a boolean and indicates whether to show the check (cross)

Line 24 Another picture is added. The code is the same whether the file is a metafile or a bitmap.

Line 25 Reset the line width to 1 point.

Lines 26 & 27 The modal parameters for element filling are now set.

Line 28 DrawArrow is similar to DrawLine except that an optional arrow head may be specified for either end. Several arrowhead types are available.

Line 29 Another line of text is added, with the default prASLine sepcified explicitly. If a parameter is entered without a dimension specified then it is assumed to be in twips. Hence "2000" is equivalent to 2000 which is equal to 100 points or about 1.38 inches.

Line 30 As an exception, FontSize interprets an integer/long as implying points rather than twips.

Lines 31-33 These lines show the different effects of the alignment options. Note that the y position is omitted as successive lines automatically update the value. All three calls use the same x position so that the effects can be seen.

Line 34 Change to a bold face

Line 35 Note that if the x position is omitted then the value from the last call is used. Compare the left hand if this line of output with the center line above.

Line 36 A second page is created. By default the current page is copied, but the inside frame is left empty. In this case the header and footer appear on the second page.

Line 37 Each page may have its orientation (portrait or landscape) specified individually. When running the demo it may be useful to click on the Show Whole Page button to see the effect.

Line 38 This time we revert to the Arabic numbering for the page.

Line 39 Here is another example of Para Text with more of the embedded formatting commands. For example <fs 20> sets the font size for the following characters whilst <it 1> turns italic on.

Line 40 Finally, the document is complete and, by default, EndDocument displays the result in the preview window, allowing the user to review it or print it as desired.

See the result for this sample
See the code to generate this sample

 

Home | Products | Services | Orders | Support | Forum | Partners | Site map | News
Copyright Mandix 1997-2004