Solved

Printing BMP Graphics From File

Posted on 2003-11-10
7
854 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 …
Learn how to use the remote presentation tool in Prezi to allow you to harness the power of this cloud based presentation platform. You can show your presentation with a remote audience using this free tool.
It’s easy to embed any of your public Prezi presentations on your website or social network to share with others. Learn how simple it is in this tutorial.

739 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