Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3695
  • Last Modified:

Issues with printing .tiff images through VB 6 application

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
sanagavarapu
Asked:
sanagavarapu
  • 3
  • 2
1 Solution
 
sgayatriCommented:
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
 
dbrckoviCommented:
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
 
sanagavarapuAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
dbrckoviCommented:
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
 
sanagavarapuAuthor Commented:
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
 
dbrckoviCommented:
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

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now