Solved

Printing BMP Graphics From File

Posted on 2003-11-10
7
839 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…

772 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