Available in the LEADTOOLS Imaging toolkit. |
PrintNewPage example for Visual Basic
'change this to a file on your system
LEAD1.Load "v:\images\babe.cmp", 0, 1, 1
' Set the variables used for preserving the aspect ratio.
HeightFactor = LEAD1.BitmapHeight
WidthFactor = LEAD1.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 = LEAD1.PrintStart
LEAD1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
'flip the image
LEAD1.Flip
'start a new page
LEAD1.PrintNewPage MyPrinter
'print the flipped image
LEAD1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
'end the print job
LEAD1.PrintEnd MyPrinter