Una pregunta., si utilizo el código
Code: Select all
SELECT PRINTER DIALOG ;
TO lSuccess ;
PREVIEW
Muchas gracias
Moderator: Rathinagiri
Code: Select all
SELECT PRINTER DIALOG ;
TO lSuccess ;
PREVIEW
Code: Select all
SELECT PRINTER DIALOG TO lSuccess PREVIEW
Hola AUGE, gracias por contestar.AUGE_OHR wrote: ↑Mon May 10, 2021 10:42 am hi,
some weeks ago we had a Problem that Image of PDF are not Print.
Sample haveand there you can select Landscape / Portrait.Code: Select all
SELECT PRINTER DIALOG TO lSuccess PREVIEW
so i´m not sure what you mean. did you have a Snapshot or some Code
Code: Select all
SELECT PRINTER DIALOG TO lSuccess PREVIEW ;
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_LETTER ; //I have never used PAPERSIZE A4 or A5 etc:
QUALITY PRINTER_REZ_MEDIUM
Efectivamente, con OpenPrinterGetPageWidth() y OpenPrinterGetPageHeight() obtengo el ancho y largo en milimetros.., pero esto es una cuestion para los de la vieja escuela....dragancesu wrote: ↑Mon May 10, 2021 5:15 pm Look file:///C:/hmg344/DOC/data/index.htm
at end you can see
New Functions:
OpenPrinterGetDC() --> hDC of the current Open Printer
OpenPrinterGetPageDC() --> hDC of the current Page being printed
IsPrintPageMetaFile() --> lBoolean
OpenPrinterGetPageWidth() --> Width (in millimeters) of the current Page being printed
OpenPrinterGetPageHeight() --> Height (in millimeters) of the current Page being printed
maybe this help
Code: Select all
LOCAL nCabecera:=0
START PRINTDOC
FOR nPagina := 1 TO nPaginas
START PRINTPAGE
FOR nLinea :=01 TO nLinsPag
IF nCabera:=0
nCabecera:=1
PoneCabecera()
nRowLin :=10
ENDIF
@ nRowLin,nMargen PRINT aLineas[ nLinNew ] ;
FONT "Courier New" SIZE 09
// --- COMPROBAMOS SALTO DE PAGINA
nRowLin ++
IF nRowLin > 60 // ¿QUE LINEAS ..A4, A5, LEGAL, EXECUTIVE, APLISADO, NORMAL...? <<-------- aqui
IF( nLinNew ==nLineas, nLinea :=nLinsPag,)
END PRINTPAGE
START PRINTPAGE
ENDIF
NEXT
END PRINTPAGE
NEXT
END PRINTDOC
FUNC PoneCabecera()
@ nRowIni,nMargen PRINT "Pagina N° " +;
STRZERO(nPagina ,03) + " De " +;
STRZERO(nPaginas,03) FONT "Courier New" SIZE 10
RETURN
Code: Select all
IF nRowLin > 60
Code: Select all
Local nLine := 10, nPage := 1 // in code
IF nLine > 60
@ nLine+1 ,nMargen PRINT "Pagina N° " + Str(nPage,3,0)
nPage := nPage+1
Nline := 10
END PRINTPAGE
START PRINTPAGE
NEXT
ENDIF
// Continue
you can calculate Width of each line, depend on Font, this Way which i found in PDFVIEW ( Sumatra )SALINETAS24 wrote: ↑Mon May 10, 2021 7:19 pmCode: Select all
@ nRowLin,nMargen PRINT aLineas[ nLinNew ] ; FONT "Courier New" SIZE 09
Code: Select all
FUNCTION GetWindowTextWidth( nHWnd, cText, lNoPrefix )
LOCAL nW := 0
LOCAL nHDC := GetDC( nHWnd )
LOCAL nHFont := GetWindowFont( nHWnd )
LOCAL aText
LOCAL n
DEFAULT lNoPrefix TO .F.
IF !HB_IsString( cText )
cText := GetWindowText( nHWnd )
ENDIF
IF lNoPrefix == .T.
cText := HB_UTF8StrTran( cText, "&", "", 1, 1 )
ENDIF
aText := HB_aTokens( cText, .T. /*lEOL*/ )
FOR n := 1 TO LEN( aText )
nW := MAX( nW, GetTextWidth( nHDC, aText[ n ], nHFont ) )
NEXT
ReleaseDC( nHWnd, nHDC )
RETURN nW
Code: Select all
IF > 60
Code: Select all
FUNCTION GetWindowTextHeight(nHWnd, cText)
LOCAL nHDC := GetDC(nHWnd)
LOCAL nH
IF ! HB_IsString(cText)
cText := GetWindowText(nHWnd)
ENDIF
nH := GetTextHeight(nHDC, cText, GetWindowFont(nHWnd)) * HB_TokenCount(cText, .T. /*lEOL*/)
ReleaseDC(nHWnd, nHDC)
RETURN nH