FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Speed up image printing
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Speed up image printing
Posted: Fri Jul 20, 2012 10:23 PM
Dear friends, how to speed up a print like this?

Code (fw): Select all Collapse
#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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Speed up image printing
Posted: Sat Jul 21, 2012 01:18 PM
Enrico

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

Rick

Code (fw): Select all Collapse
//-------------------------------------
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)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Speed up image printing
Posted: Sat Jul 21, 2012 02:39 PM

Thank you, but the problem is that DibDraw() is slow when the image is big. And SayImage() uses DibDraw(), just like SayBitmap().

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Speed up image printing
Posted: Sat Jul 21, 2012 10:06 PM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Speed up image printing
Posted: Sat Jul 21, 2012 10:29 PM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Speed up image printing
Posted: Sat Jul 21, 2012 10:36 PM

Unfortunately the size of the EMF is the same of the BMP. :-(

EMG

Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Speed up image printing
Posted: Tue Jul 24, 2012 11:00 AM

Enrico, you should use png instead of bmp to reduce the file size for a faster print.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Speed up image printing
Posted: Tue Jul 24, 2012 12:32 PM

Nope. The problem is not in the file loading but in the DIB printing.

EMG

Continue the discussion