Page 1 of 1

Speed up image printing

PostPosted: Fri Jul 20, 2012 10:23 pm
by Enrico Maria Giordano
Dear friends, how to speed up a print like this?

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oPrn

    LOCAL i

    PRINT oPrn NAME "Print test" PREVIEW
        FOR i = 1 TO 100
            PAGE
                oPrn:SayBitmap( 0, 0, "averybigbitmap.bmp", oPrn:nHorzRes(), oPrn:nVertRes() )
            ENDPAGE
        NEXT
    ENDPRINT

    RETURN NIL


Thank you in advance.

EMG

Re: Speed up image printing

PostPosted: Sat Jul 21, 2012 1:18 pm
by Rick Lipkin
Enrico

You might consider this code .. you will need to use FreeImage.dll

Rick

Code: Select all  Expand view

//-------------------------------------
Static Func PrintImage( oRsInvt )

local oPrn, Saying, cPic, cDefa, oImg

cDefa := Set(7)

If oRsInvt:Fields("PicFileName"):Value = " "
   Saying := "Sorry .. there is no Image to Print"
   MsgInfo( Saying )
   Return(.f.)
Endif

cPic := cDefa+"\Pictures\"+alltrim(oRsInvt:Fields("PicFileName"):Value)
DEFINE IMAGE oImg FILENAME cPic

PRINT oPrn from USER NAME "
Image Printing" PREVIEW MODAL
    IF EMPTY( oPRN:hDC )
       MsgInfo ( "
Image Print Cancelled" )
       RETURN(NIL)
    ENDIF

    PAGE
       oPrn:SayImage( 0, 0, oImg,2500,2500 )
    ENDPAGE
ENDPRINT

oImg:End()

Return(nil)


Re: Speed up image printing

PostPosted: Sat Jul 21, 2012 2:39 pm
by Enrico Maria Giordano
Thank you, but the problem is that DibDraw() is slow when the image is big. And SayImage() uses DibDraw(), just like SayBitmap().

EMG

Re: Speed up image printing

PostPosted: Sat Jul 21, 2012 10:06 pm
by nageswaragunupudi
If it is the same bitmap on all pages, we can print bitmap with saybitmap once and save the meta file as emf. Later load the emf and print other contents over it. I do not know if this fits the purpose.

Re: Speed up image printing

PostPosted: Sat Jul 21, 2012 10:29 pm
by Enrico Maria Giordano
nageswaragunupudi wrote:If it is the same bitmap on all pages,


Yes, it's the same.

nageswaragunupudi wrote:we can print bitmap with saybitmap once and save the meta file as emf. Later load the emf and print other contents over it. I do not know if this fits the purpose.


Thank you. I will try it.

EMG

Re: Speed up image printing

PostPosted: Sat Jul 21, 2012 10:36 pm
by Enrico Maria Giordano
Unfortunately the size of the EMF is the same of the BMP. :-(

EMG

Re: Speed up image printing

PostPosted: Tue Jul 24, 2012 11:00 am
by Marco Turco
Enrico, you should use png instead of bmp to reduce the file size for a faster print.

Re: Speed up image printing

PostPosted: Tue Jul 24, 2012 12:32 pm
by Enrico Maria Giordano
Nope. The problem is not in the file loading but in the DIB printing.

EMG