PrintWindow

HMG en Español

Moderator: Rathinagiri

Post Reply
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

PrintWindow

Post by Agustin »

Necesito imprimir la pantalla con la función PRINTWINDOW() , pero no consigo dirigir la impresión a la impresora PDFCreator.
Uso SELECT PRINTER "PDFCreator"
Alguna idea ?

Saludos cordiales
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: PrintWindow

Post by danielmaximiliano »

Hola :

tienes que seleccionar primeramente la impresora para redirigirla a ella.

Code: Select all


**********************************************************
PROCEDURE Print
**********************************************************
LOCAL nLeft, nTop, nRight, nBottom, aSelRange
LOCAL lSuccessVar
LOCAL nRow, nCol, nPag

   SELECT PRINTER DIALOG TO lSuccessVar PREVIEW 

   IF lSuccessVar == .T.
despues que tienes seleccionada imprime sobre ella.
estos son los parametros recibidos por la funcion

Code: Select all

FUNCTION PRINTWINDOW ( cWindowName , lPreview , ldialog , nRow , nCol , nWidth , nHeight )
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Re: PrintWindow

Post by Agustin »

Gracias por tu respuesta, pero mi idea es que el usuario no tenga que intervenir, y se genere el fichero pdf automáticamente en el directorio que se indica en la opción de autoguardado de PDFCreator
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Re: PrintWindow

Post by Agustin »

Añado a lo anterior, que quizás pueda cambiarse la impresora default por programa, y después de imprimir restaurar la impresora default, pero no se hacerlo
Un saludo
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: PrintWindow

Post by danielmaximiliano »

try to use this function

Code: Select all


Function main
Local cPrinter

cPrinter := GetPrinter()

If Empty (cPrinter)
  cPrinter := "PDFCreator"
EndIf
..
...
SetDefaultPrinter (cPrinter)
...
...
return

# ifndef __ XHARBOUR__

# pragma BEGINDUMP

# include "hbapi.h"

HB_FUNC_EXTERN (WIN_PRINTERSETDEFAULT); HB_FUNC (SetDefaultPrinter) {HB_FUNC_EXEC (WIN_PRINTERSETDEFAULT); }

# pragma ENDDUMP

# endif
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Re: PrintWindow

Post by Agustin »

Hola DanielMaximiliano:

Tu función puede ser lo que necesito, pero me da error:

C:\DEPOSITO\entradas.prg(5222) Error E0013 Error in #ifdef

C:\DEPOSITO\entradas.prg(5232) Error E0014 #endif does not match #ifdef

Puede ser porque no uso xharbor ?
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: PrintWindow

Post by esgici »

Viva INTERNATIONAL HMG :D
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: PrintWindow

Post by bpd2000 »

Look example attached
Attachments
1demo.rar
(821 Bytes) Downloaded 223 times
BPD
Convert Dream into Reality through HMG
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: PrintWindow

Post by danielmaximiliano »

Sorry . Update Sample

Code: Select all

#include <hmg.ch>
#require "hbwin"

/************************************************/  
Function main
/************************************************/
Public cPrinter:= GetDefaultPrinter()

DEFINE WINDOW Main AT 160 , 314 WIDTH 400 HEIGHT 300 Main TITLE 'Printer Default'

    DEFINE LABEL Label_1
        ROW    30
        COL    38
        WIDTH  250
        HEIGHT 24
        VALUE "default printer : " + cPrinter
        FONTNAME "Arial"
        FONTSIZE 12
        TOOLTIP ""
        END LABEL
	
	 DEFINE BUTTON Button_1
        ROW    97
        COL    100
        WIDTH  140
        HEIGHT 28
        ACTION Prn()
        CAPTION "Set printer PDFcreator"
    END BUTTON
	
    DEFINE LABEL Label_2
        ROW    170
        COL    38
        WIDTH  300
        HEIGHT 24
		VALUE ""
        FONTNAME "Arial"
        FONTSIZE 14
       FONTBOLD .T.
    END LABEL

END WINDOW

Main.Center
Main.Activate
Return 

/************************************************/
Function Prn()
/************************************************/
win_printerSetDefault( "PDFcreator" )
cPrinter  := "Default printer : " + GetDefaultPrinter()
Main.Label_2.Visible := .T.
Main.Label_2.Value := cPrinter
Main.Label_2.Refresh
Return
2014-04-15 11_45_17-Printer Default.jpg
2014-04-15 11_45_17-Printer Default.jpg (15.14 KiB) Viewed 4193 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Re: PrintWindow

Post by Agustin »

Ahora si funciona bien.
Muy agradecido.
Saludos
Post Reply