QHTM in HMG
Posted: Tue Dec 11, 2012 12:57 pm
Thank you amigo Esgici !!esgici wrote:My opinion is same as Daniel![]()
Thanks amigo Pablo;
please continue to support HMG by helping community
Viva HMG
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://hmgforum.com/
Thank you amigo Esgici !!esgici wrote:My opinion is same as Daniel![]()
Thanks amigo Pablo;
please continue to support HMG by helping community
Viva HMG
These problems happen even compiling in UNICODE ? Your source editor it is in UTF-8 format ?mol wrote:I've tested it, but I had problems with national fonts and CSS.
Is it possible to rsolve these problems?
Muchas gracias Luis por el apoyo de todos ustedes.luisvasquezcl wrote:Gracias Pablo,
tambien me uno a Daniel y agradezco tu esfuerzo y generosidad.
Saludos cordiales,
Luis Vasquez
Code: Select all
Static Procedure PrintHTML( cHTMLFile )
Local hContext, nCountPages, Cycle
Local hDC := _HMG_SYSDATA[374] // it is not working with this (It's what I need)
SELECT PRINTER DEFAULT ;
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_A4 ;
QUALITY PRINTER_RES_MEDIUM ;
PREVIEW
// SELECT PRINTER DIALOG TO lSuccess PREVIEW
hContext := QHTM_PrintCreateContext()
START PRINTDOC
If QHTM_PrintSetTextFile( hContext, cHTMLFile )
nCountPages := QHTM_PrintLayout( hDC, hContext )
For Cycle := 1 to nCountPages
START PRINTPAGE
QHTM_PrintPage( hDC, hContext, Cycle )
END PRINTPAGE
Next
Endif
END PRINTDOC
QHTM_PrintDestroyContext( hContext )
Return Nil
Code: Select all
Static Procedure PrintHTML( cHTMLFile )
Local hContext, nCountPages, Cycle
// Init PrintSys
hbprn:=hbprinter():new()
// Select by dialog
hbprn:selectprinter("",.T.)
// If !Empty( HBPRNERROR )
If !Empty( hbprn:error )
Return nIL
Endif
#define DM_ORIENTATION 0x00000001
#define DMORIENT_PORTRAIT 1
#define DM_PAPERSIZE 0x00000002
#define DMPAPER_A4 9 /* A4 210 x 297 mm */
// Set orientation PORTRAIT
hbprn:setdevmode(DM_ORIENTATION,DMORIENT_PORTRAIT)
// Set PaperSize DMPAPER_A4
hbprn:setdevmode(DM_PAPERSIZE,DMPAPER_A4)
// Set print margins Top 2 Left 5
hbprn:setviewportorg(2,5)
// Set Preview on
hbprn:PreviewMode := .T.
// Set preview rect 0, 0, GetDesktopRealHeight(), GetDesktopRealWidth()
hbprn:previewrect:={0, 0, GetDesktopRealHeight(), GetDesktopRealWidth()}
// Set preview scale 2
hbprn:previewscale:=2
// Set thumbnails on
hbprn:Thumbnails := .T.
hContext := QHTM_PrintCreateContext()
// Start doc name 'Print form'
hbprn:startdoc('Print form')
If QHTM_PrintSetTextFile( hContext, cHTMLFile )
nCountPages := QHTM_PrintLayout( HBPrn : hDC, hContext )
For Cycle := 1 to nCountPages
// Start Page
hbprn:startpage()
QHTM_PrintPage( HBPrn : hDC, hContext, Cycle )
// End Page
If ( _HMG_BeginTabActive , _EndTabPage() , hbprn:endpage() )
Next
Endif
hbprn:enddoc()
QHTM_PrintDestroyContext( hContext )
// Release PrintSys
hbprn:end()
Return Nil
Code: Select all
Static Procedure PrintHTML( cHTMLFile )
Local hContext, nCountPages, Cycle
SELECT PRINTER DEFAULT ;
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_A4 ;
QUALITY PRINTER_RES_MEDIUM ;
PREVIEW
// SELECT PRINTER DIALOG TO lSuccess PREVIEW
hDC := _HMG_SYSDATA[374] // it should work (this is what I need)
START PRINTDOC NAME "Print form - QHTM"
hContext := QHTM_PrintCreateContext()
If QHTM_PrintSetTextFile( hContext, cHTMLFile )
nCountPages := QHTM_PrintLayout( hDC, hContext )
For Cycle := 1 to nCountPages
START PRINTPAGE
QHTM_PrintPage( hDC, hContext, Cycle )
END PRINTPAGE
Next
Endif
END PRINTDOC
QHTM_PrintDestroyContext( hContext )
Return Nil
rathinagiri wrote:Super Pablo.
So, that means we can format our report in html also and print in the printer. That is so cool.
Yes, we can print by HTML file and by context passed by variable (type character). I put more one button to show both cases.1. Whether html code from a variable can be printed without saving it to a html file.
Yes we can use tables and other formats. See Tags.doc file in package attached file.2. Can we use tables and other alignment formats?