Speed up image printing

Speed up image printing

Postby Enrico Maria Giordano » Fri Jul 20, 2012 10:23 pm

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
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Speed up image printing

Postby Rick Lipkin » Sat Jul 21, 2012 1:18 pm

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)

User avatar
Rick Lipkin
 
Posts: 2633
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Speed up image printing

Postby Enrico Maria Giordano » Sat Jul 21, 2012 2: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
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Speed up image printing

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Speed up image printing

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Speed up image printing

Postby Enrico Maria Giordano » Sat Jul 21, 2012 10:36 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Speed up image printing

Postby Marco Turco » 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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Speed up image printing

Postby Enrico Maria Giordano » Tue Jul 24, 2012 12:32 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 22 guests