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

x
?
Solved

Issues with printing .tiff images through VB 6 application

Posted on 2004-09-22
6
Medium Priority
?
3,683 Views
Last Modified: 2013-12-26
Hi,

I am trying to print a .tiff image from VB 6 application. ImgEdit1.PrintImage is printing the image but in slightly expanded size.  The original image when printed individually is exactly fitting the page but when printed through the VB application, it is getting cut on the right hand side.  Any clue why is it happening and any possible solutions?

I appreciate your help.
0
Comment
Question by:sanagavarapu
[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
  • 2
6 Comments
 
LVL 3

Expert Comment

by:sgayatri
ID: 12131095
Use Kodak image admin control
replace form1 with your form name in the following code and try

 ImgAdmin1.Image = ImgEdit1.Image
   ImgAdmin1.PrintRangeOption = PrintAll
   ImgAdmin1.ShowPrintDialog (form1.hWnd)
   ImgAdmin1.CancelError = True
   ImgEdit1.PrintImage ImgAdmin1.PrintStartPage, ImgAdmin1.PrintEndPage, ImgAdmin1.PrintOutputFormat, True
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12131452
Hi!

Be carefull with Kodak's Imaging controls if you are planning to distribute your application.
WinXP doesn't have these controls, and it's illegal to distribute them with your applicatnion in any way.
0
 

Author Comment

by:sanagavarapu
ID: 12133034
Hi dbrckovi,
Thanks for reminding me that Kodak Imaging control does not work with WinXP. Fortunately my OS is Win2000.

Hi sgayatri,

Let me repeat my problem - download a .tif file from the internet or create one using any imaging application like Paint Shop or Kodak Imaging application(comes with any standard windows installation under Programs - accessories - Imaging) and print it. Now using the piece of code you suggested in VB print it again. When you compare both printouts, second copy will be slightly bigger than the first copy.

Your suggested solution does not help me in this case because my application will be printing several hundred images in a given folder and I do not intend to display the print control dialogue box every time. The images should be continuously printed to the default printer.  I tested your piece of code and Image control is still enlarging the images while printing.  I would like to know how to avoid that or is there anyway to make the image fit to the page while printing.

I appreciate your time though.

Any other suggestions? Thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 11

Accepted Solution

by:
dbrckovi earned 375 total points
ID: 12136168
Hi again.

I wanted to post this sollution earlier but I thought sgayatri's sollution will work, and as you'll see mine is not very elegant.


I had the same problem in my last project, and I solved it by using Printer object.
These are the steps I was using for printing:

- load the TIFF image in ImageEdit control

- save the TIFF image in BMP format:             ImgEdit.SaveAs App.path & "\temp.bmp", 3, 1, 1, 0, False

- load the picture in invisible picture box:        picTemp.Picture = LoadPicture(App.path & "\temp.bmp")

- set Printer settings:

        Printer.ScaleMode = vbPixels
        Printer.ScaleTop = 0
        Printer.ScaleLeft = 0
        Printer.ScaleWidth = 8 * frmMain.ImgCopy.ImageResolutionX
        Printer.ScaleHeight = 11.5 * frmMain.ImgCopy.ImageResolutionY

 - position the picture on a page:            Printer.PaintPicture picTemp.Picture, x, y, ImgEdit.ImageWidth, ImgEdit.ImageHeight
      ( where x and y are coordinates of pictures top-left corner)

 - send the page to printer:
       Printer.EndDoc


Note these two lines:
        Printer.ScaleWidth = 8 * frmMain.ImgCopy.ImageResolutionX
        Printer.ScaleHeight = 11.5 * frmMain.ImgCopy.ImageResolutionY

I got 8 and 11.5 by printing the scanned image and comparing the result with the original.

P.S.
I'm not sure, but if I remember correctly, the printed image will be smaller than the original for few percent, but you can play with these values to get it out perfectly.
0
 

Author Comment

by:sanagavarapu
ID: 12137134
Hi dbrckovi,

I like your idea and that is why I am accepting the answer.

I have one concern though. Printing a bmp file could lead to perfomance issues because bmp images are usually large in size compared to tiff and when I am talking about hundreds of images everyday, the additional time required to complete the job could be multiplied several times.

I did some research on the internet and evaluated few other controls and found the better replacement for Kodak Image Edit Control in "ImageViewerCP ActiveX Control" developed by Viscomsoft (http://www.viscomsoft.com/products/imageviewercp/).  The developer licence costs USD 60. It has more features than Kodak to convert the file formats, print the images reduced/enlarged, add annotations etc. I thought it is worth spending $60 keeping in mind the processing time I am gaining on a daily basis.
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12137629
Thanks for accepting.

I agree. This method is much slower, but it's still faster than any printer can print, and if you delete the temp.bmp after processing an image, it doesn't consume much disk space either.

I also thought about buying souch control becouse our company works with TIFF images a lot, but for now we're using ImageEdit.
(We'll first upgrade to .NET. Maybe it provides something for manipulating TIFF images.)

Regards!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

688 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