Home > BSPrinter documentation > Reference

PrintPreview control


This is the main object of the component.

To have print preview in a program you need to do these simple steps:

Add the necessary code to replace the Printer object to a bas module:

Public Property Get Printer() As Printer
    Set Printer = BSPrinter.PrinterReplacement
End Property

Public Property Set Printer(nPrinter As Printer)
    Set BSPrinter.PrinterReplacement = nPrinter
End Property


Then add a PrintPreview control to a form.
Double click on the control, and write this code:

Private Sub PrintPreview1_PrepareReport(Cancel As Boolean)
    MyPrintingProcedure
End Sub

Private Sub MyPrintingProcedure()
    Printer.Print "Hello Word"
    ' continue with the printing code
End Sub


Then add a command button (Command1) and this code:

Private Sub Command1_Click()
    PrintPreview1.ShowPreview
End Sub


  • Properties
  • Methods
  • Events

  • Properties

    AllowUserChangeMargins
    AllowUserChangeOrientation
    AllowUserChangePageNumbers
    AllowUserChangePaperSize
    AllowUserChangePrinter
    AllowUserChangeScale
    AuxiliaryButtonToolTipText
    AuxiliaryButtonVisible
    BottomMargin
    BottomMarginEffective
    BottomNonPrintableArea
    Canceled
    Collate
    ColorSupport
    CurrentPageInPreview
    Flags
    FontWidth
    FormatButtonVisible
    FromPage
    GDIPlusGraphics
    GridReportStyles
    HandleMargins
    LeftMargin
    LeftNonPrintableArea
    LetPrintExceedMargin
    MarginsButtonVisible
    MarginUnits
    MarginUnitsForUser
    MaxScalePercent
    MenuButtonIcon
    MenuButtonVisible
    MinBottomMargin
    MinLeftMargin
    MinRightMargin
    MinScalePercent
    MinTopMargin
    PageCount
    PageNumbersColor
    PageNumbersFont
    PageNumbersFormat
    PageNumbersPosition
    PageNumbersPositionFlags
    PageSetupButtonVisible
    PageView
    PageViewNormalSizeButtonVisible
    PreviewDialogCaption
    PreviewPagesAccuracy
    Printed
    PrintPageNumbers
    QuickPrintButtonVisible
    RememberUserPreferences
    ReportID
    ReportName
    RightMargin
    RightNonPrintableArea
    RightToLeftControl
    ScalePercent
    ShowBottomToolbar
    ShowFirstPageNumber
    ShowMargins
    ShowSketch
    SomethingPrintedOnPage
    SomethingPrintedOnReport
    StartingPageNumber
    ToolbarButtonPicture
    ToolbarIconsSize
    ToPage
    TopMargin
    TopMarginEffective
    TopNonPrintableArea
    UIButtonStyle
    UIFontName
    UILanguage
    UseAltScaleIcons

    Methods

    AddWatermark
    CapturePrinterObject
    ClearPage
    DeleteAllUserPreferences
    DeleteUserPreferences
    GetCurrentGridReportStyle
    GetDocFirstPageIndex
    GetDocLastPageIndex
    GetDocPageCount
    GetFooterPos
    GetHeaderPos
    GetLastDeviceName
    GetPageNumber
    GetPageNumberPos
    GoToPage
    PrintDirect
    PrinterExists
    PrintEx
    PrintForm
    PrintGrid
    PrintRichTextBox
    PrintWindow
    ReleasePrinterObject
    RemoveAllWatermarks
    RemovePage
    RemoveWatermark
    SaveToFile
    SelectPrinter
    SetFooter
    SetHeader
    ShowFormatOptions
    ShowPageNumbersOptions
    ShowPageSetup
    ShowPreview
    ShowPrinter
    ShowSaveToFile
    TextHeightEx
    TextWidthEx

    Events

    AfterShowingPageSetupDialog
    AfterShowingPrinterDialog
    AuxiliaryButtonClick
    BeforePrint
    BeforePrintingPageNumbers
    BeforeShowingFormatDialog
    BeforeShowingPageSetupDialog
    BeforeShowingPrinterDialog
    CurrentPrinterDefaultSettingChange
    DefaultPrinterChange
    EndDoc
    GetLocalizedText
    OrientationChange
    PaperSizeChange
    PrepareReport
    ReportPrinted
    ScaleChange
    StartDoc
    StartPage