Solved

Printing BMP Graphics From File

Posted on 2003-11-10
7
818 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
  • 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 100 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now