Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Print size is huge
Started by kenk at 09-25-2007 9:07. Topic has 7 replies.

Print Search « Previous Thread Next Thread »
  09-25-2007, 9:07
kenk is not online. Last active: 7/1/2008 1:52:27 PM kenk

Top 500 Posts
Joined on 01-30-2006
Posts 9
Print size is huge
Reply Quote

Hi,

I haveLead tools V13.

when sending a jtif compressed grayscale image to the printer, it uncompresses to an extremely large file when listed in the printer dialog.

Example:

When printing a 200 dpi 8.5x11 grayscale image with a disk file size of 57Kb, it shows a size of 16Mb in the print spool dialog.

It gets worse with mutipage tif files....I've seen them as high as 70Mb.

Even with BW images compress using CCITTG4 an image with a disk size of 6Kb shows a size of  3.65 Mb in the print spool dialog.

Is there a printer option that is incorrect?

This happens on my machine as well as our customers. They report it takes forever (5-10 min) to print the images.

Thanks.

Best regards,

Ken


   Report 
  09-25-2007, 12:50
jigar is not online. Last active: 11/18/2008 10:04:38 AM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 446
Re: Print size is huge
Reply Quote
Hello,

The sizes in the printer spool seem to be correct.  Images have to be decompressed before being sent to the printer.  How fast is the printing of images if you print from the Windows Image Viewer on the same machine with the same image?  Are the spool sizes the same?  How is the printer hooked up, through parallel, usb, or ethernet?

LEADTOOLS Technical Support
   Report 
  09-25-2007, 16:28
kenk is not online. Last active: 7/1/2008 1:52:27 PM kenk

Top 500 Posts
Joined on 01-30-2006
Posts 9
Re: Print size is huge
Reply Quote

Can you show me the math for the spooler size?

 I verified the size listed on the printer spool dialog and it was 16.6 Mb.

This is how I THINK it works.

200dpi * 8.29(image width) = 1658 pixels * 8 bits/pixel = 13264 bits

200 dpi * 5.90(image height) = 1180 pixels * 8 bits/pixel = 9440 bits

13264 bits * 9440 bits = 125212160 bits

125212160 bits/8 bits/pixel = 15,651,520(~15Mb)

I printed the the same file using Microsoft Imaging and it spooled at 5.59Mb

Thanks for the speedy reply!

Best regards,

Ken

 


   Report 
  09-26-2007, 10:07
jigar is not online. Last active: 11/18/2008 10:04:38 AM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 446
Re: Print size is huge
Reply Quote
Hello,

I wrote my own sample program to print an image.  The image was 1.6mb, 180dpi, 3072x2304.  In the printer spool it was 1.6mb.  What are you using for your printer settings?  The only settings I set for the printer were make it grayscale, since the image was in color, and set the paint engine to Win32 GDI.  If you want post some sample code (not your whole program), and I can try to replicate the issue here.

Since these forums are public, you can also send it to support@leadtools.com.  Mention this post and my name, and have the sample program in a zip file.  Even before you do that if you want to post just the code snippet where you set the printer settings and print the image, you can post it here.

LEADTOOLS Technical Support
   Report 
  09-26-2007, 11:26
kenk is not online. Last active: 7/1/2008 1:52:27 PM kenk

Top 500 Posts
Joined on 01-30-2006
Posts 9
Re: Print size is huge
Reply Quote

I am using the Printer Object to print the image.

Here is my code. Pardon me if it is more then I should have posted....

Sub PrintSinglePage(PageNum%)

'Declare the variable for printed text
    Dim msg As String
'Declare the variables for pixel measurements
    Dim TextHeightInPixels
    Dim UsableWidth
    Dim UsableHeight

    Dim lImageWidth1, lImageHeight1 As Long
    Dim WidthRatio1, HeightRatio1
    Dim lStretchedWidth1, lStretchedHeight1
    Dim ldblResolutionRatio1

    frmViewer.ctlLeadEditor.ScaleMode = vbTwips
    Printer.ScaleMode = vbTwips
    UsableWidth = Printer.ScaleWidth
    UsableHeight = Printer.ScaleHeight
   

    frmViewer.ctlLeadViewer.AutoRepaint = False

    frmViewer.ctlLeadViewer.GetFileInfo TempImageFile, PageNum + 1, 0
    frmViewer.ctlLeadViewer.LoadIFD = frmViewer.ctlLeadViewer.InfoIFD
    frmViewer.ctlLeadViewer.Load TempImageFile, 0, 1, 1
    frmViewer.ctlLeadViewer.LoadIFD = 0

    frmViewer.ctlLeadEditor.Bitmap = frmViewer.ctlLeadViewer.Bitmap
    'Calculate image size ( in TWIPS )
    If frmViewer.ctlLeadEditor.BitmapXRes >= frmViewer.ctlLeadEditor.BitmapYRes Then
       lImageWidth1    =    frmViewer.ctlLeadEditor.BitmapWidth    *    (Printer.TwipsPerPixelX / Screen.TwipsPerPixelX)
       lImageHeight1   =     (frmViewer.ctlLeadEditor.BitmapHeight    * Printer.TwipsPerPixelX /Screen.TwipsPerPixelX))    *    (frmViewer.ctlLeadEditor.BitmapXRes /    frmViewer.ctlLeadEditor.BitmapYRes)
    Else
        lImageHeight1    =    frmViewer.ctlLeadEditor.BitmapHeight    *    (Printer.TwipsPerPixelX /    Screen.TwipsPerPixelX)
        lImageWidth1    =    (frmViewer.ctlLeadEditor.BitmapWidth    *    (Printer.TwipsPerPixelX /    Screen.TwipsPerPixelX))    *    (frmViewer.ctlLeadEditor.BitmapYRes /    frmViewer.ctlLeadEditor.BitmapXRes)
    End If

'Test values
    Printer.PrintQuality = GetDeviceCaps(Printer.hdc, LOGPIXELSX)
    If Printer.PrintQuality = 0 Or frmViewer.ctlLeadViewer.BitmapXRes = 0 Then
        MsgBox "Printer.PrintQuality = " & Printer.PrintQuality & vbCrLf _
               &    "frmViewer.ctlLeadViewer.BitmapXRes    =    "    &    frmViewer.ctlLeadViewer.BitmapXRes,    vbOKOnly,    "Zero    value    detected"
        Exit Sub
    End If
    ldblResolutionRatio1 = Printer.PrintQuality / frmViewer.ctlLeadViewer.BitmapXRes

'Test values
    If lImageWidth1 = 0 Or lImageHeight1 = 0 Or UsableWidth = 0 Or UsableHeight = 0 Then
        MsgBox "lImageWidth1  = " & lImageWidth1 & vbCrLf _
            & "lImageHeight1 = " & lImageHeight1 & vbCrLf _
            & "UsableWidth = " & UsableWidth & vbCrLf _
            & "UsableHeight = " & UsableHeight, vbOKOnly, "Zero value detected"
        Exit Sub
    End If
    lImageWidth1 = lImageWidth1 * ldblResolutionRatio1
    lImageHeight1 = lImageHeight1 * ldblResolutionRatio1
    WidthRatio1 = (UsableWidth / lImageWidth1) 'in Pixels
    HeightRatio1 = (UsableHeight / lImageHeight1)

'Set the pointer to an hourglass
    Screen.MousePointer = 11

'Set Color Mode
    If frmViewer.ctlLeadEditor.BitmapBits = 1 Then
        Printer.ColorMode = 1
    Else
        Printer.ColorMode = 2
    End If

'Needed to open a print job
    Printer.Print
'Set EnlargeToPage = 0 for this test

EnlargeToPage = 0

    If EnlargeToPage = 1 Then
        Printer.CurrentY = 0
        If WidthRatio1 >= HeightRatio1 Then
            lStretchedHeight1 = UsableHeight
            lStretchedWidth1 = lStretchedHeight1 * (lImageWidth1 / lImageHeight1)
        Else
            lStretchedWidth1 = UsableWidth
            lStretchedHeight1 = lStretchedWidth1 * lImageHeight1 / lImageWidth1
        End If
    Else
        lStretchedWidth1 = lImageWidth1
        lStretchedHeight1 = lImageHeight1
        If ((lStretchedWidth1 > UsableWidth) Or (lStretchedHeight1 > UsableHeight)) Then
            If (lStretchedWidth1 > UsableWidth) Then
                lStretchedWidth1 = UsableWidth
                lStretchedHeight1    =    lStretchedWidth1    *    (lImageHeight1 /    lImageWidth1)              

           Else
                lStretchedHeight1 = UsableHeight
                lStretchedWidth1 = lStretchedHeight1 * (lImageWidth1 / lImageHeight1)                

          End If
        End If
    End If
    frmViewer.ctlLeadEditor.Render Printer.hdc, 0, 0, lStretchedWidth1, lStretchedHeight1

'Finish the page and finish the print job
    Printer.NewPage
'v2.21 moved to cmdOk:PrintDone
'Printer.EndDoc

'Set the mouse pointer back to the default
    Screen.MousePointer = 0

    Exit Sub
ErrorHandler:
'    LogGlobalError MODULE_NAME, "PrintSinglePage", Err, Erl
End Sub

 

Thanks.

Best regards,

Ken


   Report 
  09-26-2007, 12:53
jigar is not online. Last active: 11/18/2008 10:04:38 AM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 446
Re: Print size is huge
Reply Quote
Oh, you're using the Printer object.   We have a wrapper to the printer that handles most of the stuff that you are doing above.  Also, since you are using the Printer object, it is probably handing over a HBitmap handle to the hdc.  So that's why your image ends up to be 16mb in your printer spool.  For my test program, I used the printer from the LEADRasterView object.  In the Main COM Object Help file, look up the article titled "Print a Real Image Size in Inches".  It's a very easy example on how to do it.

Basically you set your BitmapWidth/BitmapHeight for the image you want printed.  Then call the PrintStart, Render, PrintEnd subroutines with the appropriate parameters.  These are all part of the LEADRasterView object.  Let me know if you have any questions.

LEADTOOLS Technical Support
   Report 
  09-26-2007, 13:28
kenk is not online. Last active: 7/1/2008 1:52:27 PM kenk

Top 500 Posts
Joined on 01-30-2006
Posts 9
Re: Print size is huge
Reply Quote

I'll try using the printer from the LEAD RasterView object.

If you have the details....can you expalin why passing the HBitmap handle to the printer hdc increases the size of the spooled image? I would like to pass that on to our customer as I'm sure he is going to ask!

Yea...one of them!

8^) 

Best regards,

Ken


   Report 
  09-26-2007, 14:34
jigar is not online. Last active: 11/18/2008 10:04:38 AM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 446
Re: Print size is huge
Reply Quote
It's really hard for me to say.  My guess is that the printer object is doing something after it gets the handle.  Or that the Render subroutine is called without calling PrintStart, so it does something to the bitmap before passing it to the handle.  Only the engineers would know the definite answer.

LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Printing » Print size is huge

Powered by Community Server, by Telligent Systems