PrintNewPage Example for Visual Basic
Dim RasterIO As New LEADRasterIO
Dim RasterProc As New LEADRasterProcess
'change this to a file on your system
RasterIO.Load LEADRasterView1.Raster, "v:\images\babe.cmp", 0, 1, 1
'note, there will be no samples for other platforms, this function is not necessary in other languages):
' Set the variables used for preserving the aspect ratio.
HeightFactor = LEADRasterView1.Raster.BitmapHeight
WidthFactor = LEADRasterView1.Raster.BitmapWidth
' Allow a maximum of 3x3 inches on a 300dpi printer
HeightAllowed = 900
WidthAllowed = 900
' Print the LEAD control, preserving the aspect ratio.
' Check to see if using the maximum width will make the image too tall.
' Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
ControlWidth = WidthAllowed
ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
Else
ControlHeight = HeightAllowed
ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
End If
'start the print job
MyPrinter = LEADRasterView1.PrintStart
LEADRasterView1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
'flip the image
RasterProc.Flip LEADRasterView1.Raster
'start a new page
LEADRasterView1.PrintNewPage MyPrinter
'print the flipped image
LEADRasterView1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
'end the print job
LEADRasterView1.PrintEnd MyPrinter