469,649 Members | 1,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

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 1094
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by venkat | last post: by
1 post views Thread by Ling Woo | last post: by
6 posts views Thread by Chris Dunaway | last post: by
4 posts views Thread by Prakash | last post: by
reply views Thread by gnewsgroup | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.