Control Reference > VSPrinter Control |
The VSPrinter control allows you to quickly and easily create documents for printing and previewing. It supports multiple columns, text wrapping, headers and footers, tables, and graphics. You can implement multiple page print previews with zooming, panning, and paging by setting a single property. The new VSPrinter control has a thumbnail preview mode that lets you see many pages at once.
The VSPrinter control is capable of exporting HTML and RTF documents that can be viewed and edited with your favorite word processor, or posted on the Web. It also features an optional built-in document navigation bar that allows users to zoom and page through preview documents.
The VSPrinter control allows you to save the documents you create to disk, and uses an efficient compression engine so the documents consume little disk space. The compression and archiving routines are exposed through the Archive method and ArchiveInfo property, which allow you to use compression for other purposes besides saving and loading VSPrinter documents. VSPrinter archives are not PKZIP-compatible, but they are compatible with archive files created with ComponentOne's VSFlexGrid Pro control.
Use the VSPrinter control to create sophisticated reports, either based on database tables or from arbitrary sources. You may also use it to produce form-type documents, newsletters, format and print data files, or to let your application create any type of custom output it needs.
Note: Before you can use a VSPrinter control in your application, you must add the VSPrint8.ocx file to your project. Please refer to the VB documentation for details on adding controls to your projects.
To distribute applications you create with the VSPrinter control, you must install and register it on the user's computer. The Setup Wizard provided with Visual Basic provides tools to help you do that. Please refer to the Visual Basic manual for details.
The VSPrinter control provides the following properties, events and methods:
All of the properties, events and methods for the VSPrinter control are listed in the following tables. Properties, events, and methods that apply only to this control, or that require special consideration when used with it, are marked with an asterisk (*). These are documented in later sections. For documentation on the remaining properties, see the Visual Basic documentation.
VSPrinter Properties
Returns or sets the caption for the default Abort dialog. |
|
Returns or sets the caption for the button in the default Abort dialog. |
|
Returns or sets the caption for the Device string in the default Abort dialog. |
|
Returns or sets the caption for the Page string in the default Abort dialog. |
|
Returns or sets whether an Abort dialog will appear while the control is printing. |
|
Returns or sets the placement for the default Abort dialog. |
|
Gets or sets the description of the control used by accessibility client applications. |
|
Gets or sets the name of the control used by accessibility client applications. |
|
Gets or sets the role of the control used by accessibility client applications. |
|
Gets or sets the value of the control used by accessibility client applications. |
|
Executes an action such as 'StartDoc' or 'EndDoc'. |
|
Appearance |
See the Visual Basic documentation. |
Gets information from a ComponentOne archive file. |
|
Gets or sets whether the control should automatically detect hyperlinks embedded in the preview document, fire the Value event, and change the cursor or perform the navigation automatically. |
|
Returns or sets whether RTF text should be automatically detected. |
|
BackColor |
See the Visual Basic documentation. |
BorderStyle |
See the Visual Basic documentation. |
Returns or sets the color of the brush used to fill graphical objects. |
|
Returns or sets the style of the brush used to fill graphical objects. |
|
Calculates the size of a paragraph, in twips, and returns results in TextWid, TextHei, X1, Y1, X2, and Y1. |
|
Calculates the size of a picture, in twips, and returns results in X1, Y1, X2, and Y1. |
|
Calculates the size of a table, in twips, and returns results in TextWid, TextHei, X1, Y1, X2, and Y1. |
|
Calculates the size of a string, in twips, and returns results in TextWid, TextHei, X1, Y1, X2, and Y1. |
|
Calculates the size of an RTF string, in twips, and returns results in TextWid, TextHei, X1, Y1, X2, and Y1. |
|
Returns or sets whether multiple copies will be collated. |
|
Returns or sets the color mode on color printers. |
|
Returns or sets the number of columns on a page. |
|
Returns or sets the spacing between columns, in twips. |
|
Returns or sets the number of copies to print. |
|
Returns the number of the column being printed. |
|
Returns the number of the line being printed. |
|
Returns the number of the page being printed. |
|
Returns or sets the horizontal position of the cursor, in twips from the left of the page. |
|
Returns or sets the vertical position of the cursor, in twips from the top of the page. |
|
Returns or sets whether device changes affect the Windows default settings. |
|
Returns or sets the name of the current printer. |
|
Returns the names of the printing devices available (zero-based vector). |
|
Returns or sets the name of the current document (alias for FileName). |
|
*DPI |
Returns the resolution of the printing device, in dots per inch. |
*Draw |
Draws an object within the rectangle defined by the X1, Y1, X2, and Y2 properties. |
Returns the name of the current printer driver. |
|
Returns or sets duplex or double-sided printing. |
|
Returns or sets the color of the area around the preview page. |
|
Enabled |
Returns/sets a value that determines whether an object can respond to user-generated events. |
Returns a code that describes an error condition. |
|
Returns a message that describes an error condition (see also the Error property). |
|
Returns or sets the name of an export file of type defined by the VSPrinter property. |
|
Returns or sets the format of the output file (HTML or RTF). |
|
Returns or sets the HTML template to be used for the navigation bar in paged HTML export files. |
|
Injects raw text into the output file specified by the VSPrinter property. |
|
Returns or sets the name of the current document. |
|
Finds a tag in the current document, returns the page and bounding rectangle (in X1,Y1,X2,Y2) for the match. |
|
Finds text in the current document, returns the page and bounding rectangle (in Y1,X2,Y2,VSPrinter) for the match. |
|
Font |
Returns a Font object. |
Returns or sets the footer text. |
|
*hDC |
Returns the control's current hDC. |
Returns or sets the color used to print headers and footers. |
|
Returns or sets the font used to draw headers and footers. |
|
Returns or sets the header text. |
|
hWnd |
Returns a handle (from Microsoft Windows) to an object's window. |
Returns or sets an additional left indent for the first line of each paragraphs, in twips. |
|
Returns or sets an additional left indent for the first line of each paragraphs, in twips. |
|
Returns or sets the right indent for paragraphs, in twips. |
|
Returns or sets the left indent for the first line of a paragraph, in twips. |
|
Returns or sets the amount of change to the VSPrinter property when the user clicks the scroll bar area. |
|
Returns or sets the amount of change to the VSPrinter property when the user clicks the scroll bar area. |
|
Returns or sets the line spacing, as a percentage (for example, 100 is single spacing, 200 is double spacing). |
|
Returns a picture loaded from a file or URL. |
|
Returns or sets the bottom margin, in twips. |
|
Returns or sets the footer margin, in twips. |
|
Returns or sets the header margin, in twips. |
|
Returns or sets the left margin, in twips. |
|
Returns or sets the right margin, in twips. |
|
Returns or sets the top margin, in twips. |
|
Returns width and height of a string, in twips, in TextHei and VSPrinter properties/ |
|
Returns True if the control is measuring text, False if it is rendering |
|
MouseIcon |
Sets a custom mouse icon. |
MousePointer |
Returns/sets the type of mouse pointer displayed when over part of an object. |
Returns True if the control is measuring text, False if it is rendering |
|
Returns or sets the color of the document navigation bar. |
|
Returns or sets the text that appears on the NavBar Zoom menu |
|
Returns or sets the text displayed on the document navigation bar. |
|
Returns or sets the type of document navigation interface provided (mouse, mouse wheel, or keyboard). |
|
Returns the number of printing devices available. |
|
Returns the number of ports to which the current printer is connected. |
|
Returns or sets the paper orientation. |
|
Returns or sets the name of a printer output file (if empty, output is sent to the printer). |
|
Returns or sets the type of border to draw around each page. |
|
Returns the number of pages in the current document. |
|
Returns the page height, in twips. |
|
Returns the page width, in twips. |
|
Returns or sets a picture with a palette that is used to render the document. |
|
Returns or sets the paper bin to use. |
|
Returns whether a given paper bin is available on the current printer. |
|
Returns or sets the height of a custom paper size, in twips. |
|
Returns or sets a standard paper size. |
|
Returns whether a given page size is available on the current printer. |
|
Returns or sets the width of a custom paper size, in twips. |
|
Renders a paragraph on the page at the current cursor position. |
|
Returns or sets the color of the pen used to outline graphical objects. |
|
Returns or sets the style of the pen used to outline graphical objects |
|
Returns or sets the width of the pen used to outline graphical objects. |
|
Returns or sets whether to use the physical size of the page or on its printable area. |
|
Returns a picture of the current preview page or sets a picture to be displayed on the page. |
|
Draws a polygon defined by a string of X,Y coordinates. |
|
Draws a line defined by a string of X,Y coordinates. |
|
*Port |
Returns or sets the name of the current port. |
Returns the names of the ports to which the current printer is connected. |
|
Returns or sets whether output saved for previewing or sent directly to the printer. |
|
Returns or sets the current preview page (first page is 1). |
|
Returns the number of pages displayed in the preview area. |
|
Returns or sets the print quality. |
|
Returns or sets whether the scrollbar thumbs (VSPrinter Control) should be proportional to the size of the visible area. |
|
Returns the current state of the control. |
|
Renders an OPP-enabled control (such as the VSFlexGrid) on the page. |
|
Returns a string containing the first tag found on a region of the current document. |
|
Returns a string containing the text on a region of the current document. |
|
Returns or sets the percentage by which the printed output is to be scaled. |
|
Returns or sets the left coordinate of the visible area, in twips. |
|
Returns or sets the top coordinate of the visible area, in twips. |
|
Returns or sets whether margin guides are displayed on the page. |
|
Returns or sets the amount of change to the VSPrinter property when the user clicks the scroll arrow. |
|
Returns or sets the amount of change to the VSPrinter property when the user clicks the scroll arrow. |
|
Returns or sets the vertical distance after each paragraph, in twips. |
|
Returns or sets the vertical distance before each paragraph, in twips. |
|
Returns a collection of styles that can be applied to the document. |
|
Renders a table on the page. |
|
Returns or sets the type of border for tables. |
|
Returns or sets properties of a table cell or range. |
|
Returns or sets the width of the borders between table cells. |
|
Returns or sets the width of the left and right table borders. |
|
Returns or sets the width of the top and bottom table borders. |
|
Returns or sets the characters used by tables as row and column separators. |
|
*Text |
Renders a string on the page at the current cursor position. |
Returns or sets the alignment of printed paragraphs, textboxes, and tables. |
|
Returns or sets the text angle, in tenths of degree. |
|
Returns or sets the color used to print text. |
|
Returns the height of a string measured with the Measure property, in twips. |
|
Returns the height of a string, in twips. |
|
Renders RTF text on the page at the current cursor position. |
|
Returns the width of a string measured with the VSPrinter property, in twips. |
|
Returns the width of a string, in twips. |
|
Returns or sets whether scrolling occurs as the user drags the scroll thumb. |
|
Returns or sets how TrueType fonts should be printed. |
|
Returns the number of twips per printer pixel in the horizontal direction. |
|
Returns the number of twips per printer pixel in the vertical direction. |
|
*URL |
Returns or sets the name of a URL (Universal Resource Locator) to load into the control. |
Returns the version of the control currently loaded. |
|
*X1 |
Returns or sets the left coordinate of the rectangle used with the VSPrinter property. |
*X2 |
Returns or sets the right coordinate of the rectangle used with the VSPrinter property. |
*Y1 |
Returns or sets the top coordinate of the rectangle used with the VSPrinter property. |
*Y2 |
Returns or sets the bottom coordinate of the rectangle used with the VSPrinter property. |
*Zoom |
Returns or sets the preview scale: set to a percentage, or zero to fill the control. |
Returns or sets the maximum valid zoom factor. |
|
Returns or sets the minimum valid zoom factor. |
|
Sets or returns the zoom mode (explicit percentage or one of the automatic settings). |
|
Returns or sets the step for zooming with the mouse. |
VSPrinter Methods
Adds a hyperlink to the document. |
|
Adds a Target tag (%PDFName|<name>) to the document at the cursor position. |
|
Renders a table with row headers and special formatting. |
|
Renders a variant array as a table with row headers and special formatting. |
|
Adds, extracts, or deletes files from a ComponentOne archive file. |
|
Clears the control, destroying any currently loaded document. |
|
Converts mouse coordinates to page coordinates. |
|
Draws a circle, circular wedge, or circular arc. |
|
Draws an ellipse, wedge, or arc. |
|
Draws a line segment. |
|
Draws a picture. |
|
Draws a rectangle. |
|
Fired after a document is successfully printed. |
|
Closes a page that was opened with the StartOverlay method. |
|
Renders table defined since call to StartTable. |
|
Ends the definition of a document tag started with StartTag. |
|
Returns the printable area, excluding margins, in the X1, Y1, X2, and Y2 properties. |
|
Cancels and deletes the current document. |
|
Loads a document from disk. |
|
Moves a group of pages to the start or to the end of the document |
|
Skips to the next column. |
|
Skips to the next page. |
|
Converts page coordinates to mouse coordinates |
|
Displays a printer selection or page setup dialog. |
|
Prints the current document (being previewed) on the printer. |
|
Prints the current document (being previewed) on the printer. |
|
*Refresh |
See the Visual Basic documentation. |
Saves the current document to disk. |
|
Scrolls the control so the specified rectangle or point is visible. |
|
Starts a new document. |
|
Reopens an existing preview page for additional output. |
|
Defers table rendering until call to EndTable. |
|
Starts the definition of a document tag (for later use with the FindTag and RetrieveTag methods). |
|
Draws text within a rectangle. |
VSPrinter Events
Fired after printing the footer for each page to allow font changes. |
|
Fired after printing the header for each page to allow font changes. |
|
Fired after a table cell is rendered, to allow custom painting. |
|
Fired after switching preview pages in response to a user request. |
|
Fired after scrolling in response to a user request. |
|
Fired after Zooming in or out in response to a user request. |
|
Fired before printing the footer for each page to allow font changes. |
|
Fired before printing the header for each page to allow font changes. |
|
Fired before a table cell is rendered, to allow custom formatting. |
|
Fired before switching preview pages in response to a user request. |
|
Fired before scrolling in response to a user request. |
|
Fired before Zooming in or out in response to a user request. |
|
Click |
See the Visual Basic documentation. |
DblClick |
See the Visual Basic documentation. |
Fired after a document is successfully printed. |
|
Fired after each page is complete. |
|
Fired when an error is detected (a code is returned in the Error property). |
|
KeyDown |
See the Visual Basic documentation. |
KeyPress |
See the Visual Basic documentation. |
KeyUp |
See the Visual Basic documentation. |
Fired when the thumbnail preview is about to change to allow customization of the preview layout. |
|
Fired while loading documents from disk, once after each page is loaded. |
|
MouseDown |
See the Visual Basic documentation. |
Fired when the user clicks or moves the mouse over a hyperlink (see AutoLinkNavigate property). |
|
MouseMove |
See the Visual Basic documentation. |
MouseUp |
See the Visual Basic documentation. |
Fired after each column and page break. |
|
Fired after each line break. |
|
Fired after each page is created. |
|
Fired after the state of the control changes. |
|
Fired after a page is ejected and before the next page is started. |
|
Fired while saving documents to disk, once after each page is saved. |
|
Fired after a new document is created. |