Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Print the Jpg / Gif / Bmp File to Paper Size
Author:
krishna
E-mail:
Click to e-mail author
Submitted:
8/23/2006
Version:
VB6
Compatibility:
VB6
Category:
Miscellaneous
Views:
20876
print the Jpg / Gif / Bmp file to Paper size
Declarations:
'send filepath as string to this function
Code:
Public Function BMPPRINT(ByVal filepath As String) 'To make Picture to fit the PAGE SIZE (Auto FIT 2 PAGE SIZE) On Error Resume Next Dim PicRatio As Double Dim printerWidth As Double Dim printerHeight As Double Dim printerRatio As Double Dim printerPicWidth As Double Dim printerPicHeight As Double Picture1.Picture = LoadPicture(filepath) 'Not Functioning well - Block removed 'If Picture1.Height >= Picture1.width Then ' Printer.Orientation = vbPRORPortrait 'Else ' Printer.Orientation = vbPRORLandscape 'End If PicRatio = Picture1.width / Picture1.Height printerWidth = Printer.ScaleX(Printer.ScaleWidth, Printer.ScaleMode, vbHimetric) printerHeight = Printer.ScaleY(Printer.ScaleHeight, Printer.ScaleMode, vbHimetric) printerRatio = printerWidth / printerHeight If PicRatio >= printerRatio Then printerPicWidth = Printer.ScaleX(printerWidth, vbHimetric, Printer.ScaleMode) printerPicHeight = Printer.ScaleY(printerWidth / PicRatio, vbHimetric, Printer.ScaleMode) Else printerPicHeight = Printer.ScaleY(printerHeight, vbHimetric, Printer.ScaleMode) printerPicWidth = Printer.ScaleX(printerHeight * PicRatio, vbHimetric, Printer.ScaleMode) End If 'Printer.PaintPicture Picture1.Picture, 0, 0, printerPicHeight, printerPicWidth Printer.PaintPicture Picture1.Picture, 0, 0, 12000, 12000 Wait (2) 'Printer.enddoc is must DONT DELETE THIS BELOW LINE @ any COST ' ------------------------ Printer.EndDoc '**** IMP End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement