Página 1 de 1

Lentitud al imprimir

Publicado: Dom Oct 28, 2007 5:22 pm
por Xevi
Estoy pasando una aplicación de Contabilidad que tengo desarrollada en C3 a
Xailer+xHarbour, y un detalle que me ha sorprendido es la "pesadez" al
imprimir que tengo con Xailer+xHarbour.
Cuando un listado de unas 100 páginas en C3 es prácticamente instantáneo, la
misma rutina aplicada a Xailer+xHarbour, es "lenta" puede tardar unos 12 a
25 segundos en mostrar el Preview, dependiendo del contenido que deba
imprimir en cada página.
Bien, pues me ha dado por hacer pruebas, que no sea que yo esté haciendo mal
algunos bucles o alguna programación, y por eso sea un listado "pesado",
pero me doy cuenta que es en todos los informes que voy pasando.
Me ha dado por modificar el Sample de Xailer "PrinterInfo" y darle a
imprimir 100 páginas al pulsar el botón "Print Test".
Adjunto el Sample modificado para que lo podais probar. Bien, pues como ha
sido el resultado que obtengo que para presentarme el Preview de 100 páginas
veo que realmente tarda mas de 10 segundos, y estoy en un maquinon...
Pentium4 IntelCuore2 Duo 1.66GHz con 1Mb RAM.
No es por sacar a testear uno u otro producto, pues realmente me he quedado
definitivamente con Xailer+xHarbour, sinó que es por comentar y ver si se
puede "mejorar" el rendimiento de la clase TPrinter, pues nose de mi que
será cuando empiece a listar diarios completos de 500 o 1000 páginas, y lo
intente en un Pentium4 de los de hace 4 añitos.
Gracias.
Un Saludo,
Xevi.

Lentitud al imprimir

Publicado: Dom Oct 28, 2007 5:24 pm
por Xevi
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Lun Oct 29, 2007 10:22 am
por ignacio
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Lun Oct 29, 2007 10:28 am
por ignacio
Xevi,
Por cierto: Cuando tengas que imprimir más de 1000 hojas te recomiendo que la impresión la fuerces directa, y te aseguro que Xailer habrá terminado muchí­iiiiiiiisimo antes que tu impresora, por muy potente que sea.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje news:4725a656$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Mié Oct 31, 2007 10:35 am
por Xevi
Ignacio,
Si eso ya lo he probado y no hay problema alguno cuando no se utiliza la vista previa.
Es rapidí­simo!!!
Un Saludo,
Xevi.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje de noticias news:4725a7ba$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Por cierto: Cuando tengas que imprimir más de 1000 hojas te recomiendo que la impresión la fuerces directa, y te aseguro que Xailer habrá terminado muchí­iiiiiiiisimo antes que tu impresora, por muy potente que sea.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje news:4725a656$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Mié Oct 31, 2007 10:39 am
por Xevi
Ignacio,
No me dejas muy convencido, no creas.
Estoy imprimiendo en la misma impresora y mismo ordenador, en una aplicación obtengo la vista preliminar de inmediato y en Xailer me llega a tardar 25 segundos por una vista preliminar de 125 o 150 páginas.
Igual se puede optimizar la clase TPrinter o TPreview, no se cual es la causante...
Como bien has probado, yo también lo he hecho, y casi con StartPage() EndPage() los tiempos no difieren... ¿se podrí­an revisar estos eventos??? Igual estoy diciendo una tonteria, pero todo sea por mejor el rendimiento, me atrevo a proponerlo.
Gracias por vuestro tiempo.
Un Saludo,
Xevi.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje de noticias news:4725a656$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Mié Oct 31, 2007 11:02 am
por ignacio
Xevi,
Mira tu el código y me cuentas, como verás son métodos de muy pocas lí­neas que hacen puras llamadas al API. En cualquier caso, creo que quedo bastante demostrado que el cuello de botella está en los driver de impresoras y no en Xailer.
Es posible que te esté confudiendo el hecho de que la otra aplicación muestra el preview en cuanto tiene la primera hoja, pero en mi opinión es es una operación bastante arriesgada por múltiples motivos. Tambí­en es posible que la otra aplicación realmente al hacer preview no utilize el driver de impresora, sino que utiliza un hDC de tipo pantalla, en cuyo caso lo considero erróneo pues los resultados no son realmente WYSIWYG.
Un saludo
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=47284d56@ozsrv2.ozlan.local...]47284d56@ozsrv2.ozlan.local...[/email]
Ignacio,
No me dejas muy convencido, no creas.
Estoy imprimiendo en la misma impresora y mismo ordenador, en una aplicación obtengo la vista preliminar de inmediato y en Xailer me llega a tardar 25 segundos por una vista preliminar de 125 o 150 páginas.
Igual se puede optimizar la clase TPrinter o TPreview, no se cual es la causante...
Como bien has probado, yo también lo he hecho, y casi con StartPage() EndPage() los tiempos no difieren... ¿se podrí­an revisar estos eventos??? Igual estoy diciendo una tonteria, pero todo sea por mejor el rendimiento, me atrevo a proponerlo.
Gracias por vuestro tiempo.
Un Saludo,
Xevi.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje de noticias news:4725a656$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Mié Oct 31, 2007 11:22 am
por Xevi
Ignacio,
>Tambí­en es posible que la otra aplicación realmente al hacer
<preview no utilize el driver de impresora, sino que utiliza un hDC de tipo
>pantalla, en cuyo caso lo considero erróneo pues los resultados
>no son realmente WYSIWYG.
Eso si me convence mas... casi que lo mas seguro puede ser eso que mencionas.
Gracias.
Un Saludo,
Xevi.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje de noticias news:472852b5$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Mira tu el código y me cuentas, como verás son métodos de muy pocas lí­neas que hacen puras llamadas al API. En cualquier caso, creo que quedo bastante demostrado que el cuello de botella está en los driver de impresoras y no en Xailer.
Es posible que te esté confudiendo el hecho de que la otra aplicación muestra el preview en cuanto tiene la primera hoja, pero en mi opinión es es una operación bastante arriesgada por múltiples motivos. Tambí­en es posible que la otra aplicación realmente al hacer preview no utilize el driver de impresora, sino que utiliza un hDC de tipo pantalla, en cuyo caso lo considero erróneo pues los resultados no son realmente WYSIWYG.
Un saludo
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=47284d56@ozsrv2.ozlan.local...]47284d56@ozsrv2.ozlan.local...[/email]
Ignacio,
No me dejas muy convencido, no creas.
Estoy imprimiendo en la misma impresora y mismo ordenador, en una aplicación obtengo la vista preliminar de inmediato y en Xailer me llega a tardar 25 segundos por una vista preliminar de 125 o 150 páginas.
Igual se puede optimizar la clase TPrinter o TPreview, no se cual es la causante...
Como bien has probado, yo también lo he hecho, y casi con StartPage() EndPage() los tiempos no difieren... ¿se podrí­an revisar estos eventos??? Igual estoy diciendo una tonteria, pero todo sea por mejor el rendimiento, me atrevo a proponerlo.
Gracias por vuestro tiempo.
Un Saludo,
Xevi.
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escribió en el mensaje de noticias news:4725a656$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
Xevi,
Tiempos de impresión de 100 paginas en mi maquina:
OKI C5600 en red: 4.28 segundos
Microsoft Office Document Image Writer en local: 0.70 segundos
HP Laserjet 1320 en local: 13.87 segundos
Generic/Text only en local: 1.97
Adobe PDF: 5.90
Como puedes ver los que tardan son realmente las impresoras. El hecho de que con MODIW sólo tarde 0.70 segundos te demuestra claramente que el cuello de botella no está en Xailer.
He hecho alguna prueba más quitando absolutamente cualquier impresión, es decir, dejando sólo las llamadas a StartPage() y EndPage() y los tiempos no difieren casi.
Además has de tener en cuenta que siempre se consume más tiempo en imprimir utilizando Preview que imprimiendo directamente.
Un saludo,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Xevi" <xevicomas@gmail.com> escribió en el mensaje news:[email=4724b7d9@ozsrv2.ozlan.local...]4724b7d9@ozsrv2.ozlan.local...[/email]
No me deja enviar el fichero adjunto...
Aquí­ pongo el código del Form1.prg de PrinterInfo...
/*
* Proyecto: PrinterInfo
* Fichero: Form1.prg
* Descripción:
* Autor:
* Fecha: 17/06/2004
*/
#include "Xailer.ch"
CLASS TForm1 FROM TForm
COMPONENT oLabel1
COMPONENT oListbox1
COMPONENT oLabel2
COMPONENT oEdiDefPrinter
COMPONENT oButton1
COMPONENT oButton2
COMPONENT oButton3
COMPONENT oButton4
COMPONENT oLabel3
COMPONENT oButton5
COMPONENT oButton6
COMPONENT oBrw
COMPONENT oButton7
COMPONENT oButton8
METHOD CreateForm()
METHOD Listbox1Change( oSender, nIndex )
METHOD FormInitialize( oSender )
METHOD Button1Click( oSender )
METHOD Button6Click( oSender )
METHOD Button2Click( oSender )
METHOD Button4Click( oSender )
METHOD Button3Click( oSender )
METHOD Button5Click( oSender )
METHOD EdiDefPrinterCreate( oSender )
METHOD UpdateInfo()
METHOD Button7Click( oSender )
METHOD Button8Click( oSender )
ENDCLASS
#include "Form1.xfm"
//---------------------------------------------------------- --------------------
METHOD Listbox1Change( oSender, nIndex ) CLASS TForm1
Printer:nPrinterIndex := nIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
with object ::oListbox1
:aItems := Printer:aPrinterNames
:nIndex := Printer:nPrinterIndex
end with
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
Printer:Setup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button6Click( oSender ) CLASS TForm1
local aData
aData := Printer:GetPrinterFonts()
MsgPrinterFonts( aData )
RETURN Nil
//---------------------------------------------------------- --------------------
static function MsgPrinterFonts( aData )
local cString
local nFor
cString := ""
For nFor := 1 to len( aData )
cString += aData[ nFor ] + CRLF
Next
If Empty( cString )
cString := "No Printer Fonts found"
Endif
MsgInfo( cString, "Printer Fonts" )
return nil
//---------------------------------------------------------- --------------------
METHOD Button2Click( oSender ) CLASS TForm1
Printer:Run()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button4Click( oSender ) CLASS TForm1
Printer:DocumentSetup()
::Update()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button3Click( oSender ) CLASS TForm1
Printer:PageSetup()
::oListbox1:nIndex := Printer:PrinterIndex
::UpdateInfo()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button5Click( oSender ) CLASS TForm1
LOCAL ofrmPreview, oFont, oPen, oBmp, oJpg, oBrush
local n := 100
Local nX
oFont := TFont():New()
oPen := TPen():New( PS_SOLID, 1, CLR_RED )
oBmp := TPicture():Load( "Computer64" )
oJpg := TPicture():Load( "xailer" )
oBrush := TBrush():Create(HS_BDIAGONAL,clRed)
WITH OBJECT oFont
:cName := "Arial"
:nSize := 18
:lBold := .t.
END WITH
Printer:lPreview := .t.
Printer:cJobTitle := "Xailer: Printer cJobTitle"
Printer:StartDoc()
Printer:oCanvas:nMapMode := mmHIMETRICS
Application:lBusy := .T.
For nX:=1 to 25
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:oFont := oFont
:oPen := oPen
:DrawPicture( {100, 1500, 2000, 2500}, oJpg )
:TextOut( 0, 0, "This first line should be shown partially in almost any printer")
:TextOut( 100, 100, "The above line should be cutted on almost any printer")
:MoveTo( 0+n, 0+n )
:LineTo( 2100-n, 2970-n )
:LineTo( 0+n, 2970-n )
:LineTo( 0+n, 0+n )
:LineTo( 2100-n, 0+n )
:LineTo( 2100-n, 2970-n )
:lTransparent := .f.
:nClrPane := CLR_YELLOW
:oFont:nSize := 14
:TextRect( {1000, 1000, 1500, 1500}, "Xailer printing demo", CLR_BLUE)
:lTransparent := .t.
:nClrPane := CLR_WHITE
:nMapMode := mmSIMULCHAR
:oFont:nSize := 12
:oFont:lBold := .f.
:nTextAlignment:=taRIGHT
For n := 10 to :TextLines()
:TextOut( 4, n, "Xailer printing demo, line: " + ltrim( str( n ) ),30, CLR_BLUE)
Next
:nTextAlignment:=taLEFT
:nMapMode := mmHIMETRICS
:nClrPane := CLR_BLACK
:Rectangle( {700, 200, 800, 300} )
:nClrPane := CLR_GREEN
:RoundRect( {1100, 200, 1200, 300} )
:DrawPicture( {1100, 200, 1200, 300}, oBmp )
:nClrPane := clBlue
:lTransparent := .t.
:Rectangle( { 1000, 500, 1700, 800 }, oBrush )
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Second page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Third page")
END WITH
Printer:EndPage()
Printer:StartPage()
WITH OBJECT Printer:oCanvas
:TextOut( 100, 100, "Forth page")
END WITH
Printer:EndPage()
Next
Application:lBusy := .F.
Printer:EndDoc()
//Printer:Preview()
with object Printer:PreviewControl()
:nZoomIndex := 8
:oParent:Show()
end with
oFont:Destroy()
oBmp:Destroy()
oJpg:Destroy()
oBrush:Destroy()
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD EdiDefPrinterCreate( oSender ) CLASS TForm1
oSender:cText := Printer:cPrinterName + " (" + str( Printer:nPrinterIndex, 1) + ")"
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdateInfo() CLASS TForm1
local aData := {}
Aadd( aData, { "Port", Printer:Port() } )
Aadd( aData, { "Server", Printer:ServerName() } )
Aadd( aData, { "Share", Printer:ShareName() } )
Aadd( aData, { "Driver", Printer:DriverName() } )
Aadd( aData, { "Orientation", str( Printer:nOrientation, 1 ) } )
Aadd( aData, { "Paper type", str( Printer:nPaperSizeType, 10 ) } )
Aadd( aData, { "Paper width (mm*10)", str( Printer:nPaperWidth, 10 ) } )
Aadd( aData, { "Paper height (mm*10)", str( Printer:nPaperLength, 10 ) } )
Aadd( aData, { "Copies", str( Printer:nCopies, 10 ) } )
Aadd( aData, { "Bin", str( Printer:nDefaultBin, 10 ) } )
Aadd( aData, { "Color", iif( Printer:nColor > 0, "Yes", "No" ) } )
Aadd( aData, { "Duplex", iif( Printer:nDuplex > 0, "Yes", "No" ) } )
Aadd( aData, { "Resolution", str( Printer:Resolution[ 1 ], 5 ) + " , " + str( Printer:Resolution[ 2 ], 5 ) } )
Aadd( aData, { "Paper Resolution", str( Printer:PaperRes[ 1 ], 5 ) + " , " + str( Printer:PaperRes[ 2 ], 5 ) } )
Aadd( aData, { "Printeable Paper Size (mm*10)", str( Printer:PaperSize[ 1 ], 5 ) + " , " + str( Printer:PaperSize[ 2 ], 5 ) } )
Aadd( aData, { "Non printeable offset (mm*10)", str( Printer:PhysicalOffset[ 1 ], 5 ) + " , " + str( Printer:PhysicalOffset[ 2 ], 5 ) } )
Aadd( aData, { "Collate", iif( Printer:lCollate, "Yes", "No" ) } )
Aadd( aData, { "Print Quality", str( Printer:nPrintQuality, 10 ) } )
Aadd( aData, { "Printer State", str( Printer:nStatus, 10 ) } )
with object ::oBrw
:SetArray( aData )
:aCols[ 1 ]:nWidth := 150
:aCols[ 2 ]:nWidth := 190
:GoTop()
end with
RETURN NIL
//---------------------------------------------------------- --------------------
METHOD Button7Click( oSender ) CLASS TForm1
local aNames, aNumbers
local cString
local nFor
aNames := Printer:GetBinSourceNames()
aNumbers := Printer:GetBinSourceTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Bins found"
Endif
MsgInfo( cString, "Printer Bins" )
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Button8Click( oSender ) CLASS TForm1
local aNames, aSizes, aNumbers
local cString
local nFor
aNames := Printer:GetPaperNames()
aSizes := Printer:GetPaperSizes()
aNumbers := Printer:GetPaperTypes()
cString := ""
For nFor := 1 to len( aNames )
cString += aNames[ nFor ] + " [ " + Ltrim( Str( aSizes[ nFor, 1 ] ) ) + " x " +;
Ltrim( Str( aSizes[ nFor, 2 ] ) ) + " ]" +;
" ( " + Ltrim( Str( aNumbers[ nFor ] ) ) + ")" + CRLF
Next
If Empty( cString )
cString := "No Printer Papers found"
Endif
MsgInfo( cString, "Printer Papers" )
RETURN Nil
//---------------------------------------------------------- --------------------
--

Lentitud al imprimir

Publicado: Mié Oct 31, 2007 12:51 pm
por ignacio
Xevi,
Ok. Por cierto, quise decir 'utilice'. Perdón por el error sintáctico.
Un saludo
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
--