Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing BMP Graphics From File

Posted on 2003-11-10
7
Medium Priority
?
877 Views
Last Modified: 2013-11-19
How do you print a BMP file on the printer?  I would like to print it in the high resolution the image is saved in (300 dpi).  I used the PictureBox before as the intermediate step but it does not preserve the 300 dpi resolution when it was printed out on the printer.  I don't mind using an API call if somebody can show me how.
0
Comment
Question by:limva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9717598
The only way that comes to mind is to use paintpicture (or is that what you've already tried)

Syntax

object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

0
 
LVL 3

Expert Comment

by:gajendra
ID: 9719958
I would like to extend TomLaw1999's comment.

Use LoadPicture to load the bitmap graphic from the file first and then Print it with PaintPicture.

Dim pic as StdPicture

set pic = LoadPicture("FileName.Bmp")

Printer.PaintPicture pic, .....

Hope that helps

Gajendra
0
 

Author Comment

by:limva
ID: 9720182

Hi TomLaw1999 and gajendra.

Thanks for your comments.  I've tried PaintPicture using the PictureBox with disappointing result.  However, I will try your suggestions (using the "set pic = ...") after I've installed the scanner tomorrow and let you guys know what happens.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:limva
ID: 9723741
OK, I scanned a document in 300 dpi resolution and saved it as a BMP file.  Then I used the following code in VB6 to print:

   Dim Pic As StdPicture
   Set Pic = LoadPicture("C:\Windows\Desktop\test.bmp")
   Printer.PrintQuality = 300
   Printer.PaintPicture Pic, 0, 0
   Printer.EndDoc

It printed out an oversized document.  That means VB converted the image into 72 dpi and printing it as such.  That is the exact problem I had using the PictureBox route.

Any other suggestions?
0
 
LVL 4

Accepted Solution

by:
TomLaw1999 earned 400 total points
ID: 9724726
Hi Limva,

Have you tried something like:

 Printer.PaintPicture Pic, 0, 0,100,100

(The last two figures control the height & width
0
 

Author Comment

by:limva
ID: 9727360
Hi TomLaw1999,

I used the MS Word object to print:

    Dim Doc As Word.Document
    Set Doc = New Word.Document
    Doc.InlineShapes.AddPicture "C:\Windows\Desktop\test.bmp"
    Doc.PrintOut
    Doc.Close
    Set Doc = Nothing

The above code works.  Then I tested your code and the results of the 2 codes were identical.  Your code is simpler because it doesn't have to deal with the Word object.  I'll use your code and I'll give you the points!  Thanks!
0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9729692
Thanks limva - must confess I never thought of using MS Word - good idea.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question