473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Printing scanend images

I am writing a program in Visual Studio 2005 (VB) that can print scanned
images (saved as jpg-files). The printing is done by the following code:

Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
Handles PrintDocument.PrintPage
Dim i As Integer
Dim intPrintAreaHeight, intPrintAreaWidth, marginLeft, marginTop
As Int32

With PrintDocument.DefaultPageSettings
intPrintAreaHeight = .PaperSize.Height - .Margins.Top - .Margins.Bottom
intPrintAreaWidth = .PaperSize.Width - .Margins.Left - .Margins.Right
marginLeft = .Margins.Left ' X coordinate
marginTop = .Margins.Top ' Y coordinate
End With
'
If PrintDocument.DefaultPageSettings.Landscape Then
Dim intTemp As Int32
intTemp = intPrintAreaHeight
intPrintAreaHeight = intPrintAreaWidth
intPrintAreaWidth = intTemp
End If

Dim rectPrintingArea As New RectangleF(marginLeft, marginTop, intPrintAreaWidth,
intPrintAreaHeight)

e.Graphics.DrawImage(Picturebox.Image, marginLeft, marginTop)
End Sub

Before calling this procedure Picturebox is loaded with the desired JPG-file
using:

Picturebox.image = image.fromwile("picture.jpg")

The picture files (jpg-files) should all be printed on a single page, but
they were scanned and saved in different resolutions (varying from 150 dpi
to 400 dpi). The result is, that the high resolution images do not fit on
a single page.

My question is: how can I ensure, that the image fits a single page, regardless
its resolution?
Apr 28 '06 #1
1 1192
Anyone, please?
I am writing a program in Visual Studio 2005 (VB) that can print
scanned images (saved as jpg-files). The printing is done by the
following code:

Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs)
Handles PrintDocument.PrintPage
Dim i As Integer
Dim intPrintAreaHeight, intPrintAreaWidth, marginLeft,
marginTop
As Int32
With PrintDocument.DefaultPageSettings
intPrintAreaHeight = .PaperSize.Height - .Margins.Top -
.Margins.Bottom
intPrintAreaWidth = .PaperSize.Width - .Margins.Left -
.Margins.Right
marginLeft = .Margins.Left ' X coordinate
marginTop = .Margins.Top ' Y coordinate
End With
'
If PrintDocument.DefaultPageSettings.Landscape Then
Dim intTemp As Int32
intTemp = intPrintAreaHeight
intPrintAreaHeight = intPrintAreaWidth
intPrintAreaWidth = intTemp
End If
Dim rectPrintingArea As New RectangleF(marginLeft, marginTop,
intPrintAreaWidth, intPrintAreaHeight)

e.Graphics.DrawImage(Picturebox.Image, marginLeft, marginTop)
End Sub
Before calling this procedure Picturebox is loaded with the desired
JPG-file using:

Picturebox.image = image.fromwile("picture.jpg")

The picture files (jpg-files) should all be printed on a single page,
but they were scanned and saved in different resolutions (varying from
150 dpi to 400 dpi). The result is, that the high resolution images do
not fit on a single page.

My question is: how can I ensure, that the image fits a single page,
regardless its resolution?

May 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Roger Shrubber | last post by:
Hello all I have created a page which has several pictures on it. Each picture is surrounded by a frame made from actual photos of real picture frames, consisting of four corner tiles and four...
4
by: venkat | last post by:
Hi all, I need print a webpage from internet explorer. The page may contain images, links, stylesheets etc. how will i send all these things to server side for printing. I am using asp.net with...
1
by: Frank.Sebesta | last post by:
I have a employees database with a picture that shows on a form with employee information. Similar to the Northwinds sample database. When I print the record, my output is only the data and does...
1
by: Ling Woo | last post by:
Hello My application needs to print images that are created within it. The images are BitMaps and are placed in PictureBoxes. 1.) Can anyone tell me how to I can code so the images are sent to...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
2
by: letsgetsilly | last post by:
I'm developing the external corporate website for my company in Visual Studio 2003 using html, css, and a user web control for the header/navigation. When I try to print any of the pages only the...
4
by: Prakash | last post by:
I'm developing an HR package which would contain the Employees Photo + upto 3 pages (pictures) of his Passport + pictures of his Driving License and Residence Card. If the user wants to print...
0
by: gnewsgroup | last post by:
In my asp.net 2.0 web application. I create chart images on the fly by getting the data from the database. These chart images all have fixed width, but the height is dynamic depending on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.