Imprimiendo con FiveTouch

Imprimiendo con FiveTouch

Postby Antonio Linares » Tue Mar 12, 2019 2:43 pm

Necesitas descargar la nueva versión de FiveTouch desde aquí:

https://github.com/FiveTechSoft/fivetouch-Qt-Creator-4.8.2-and-Qt-5.12.1-2019/tree/master/download

print01.prg
Code: Select all  Expand view
#include "FiveTouch.ch"

function Main()

   QPrintPreviewDialog( QPrinter() ):Exec()

return nil
 


Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Imprimiendo con FiveTouch

Postby Antonio Linares » Tue Mar 12, 2019 3:37 pm

Un ejemplo completo:

Los defines de QT print están aquí:
https://doc.qt.io/archives/qt-4.8/qprinter.html

print02.prg
Code: Select all  Expand view
#include "FiveTouch.ch"

#define QPRINTER_A4            0
#define QPRINTER_PORTRAIT    0
#define QPRINTER_MILLIMETER   0
#define QPRINTER_NATIVEFORMAT  0

function Main()

      local oPrinter, oPrintPreviewDialog

      oPrinter = QPrinter()
      oPrinter:setPageSize( QPageSize( QPRINTER_A4 ) )
      oPrinter:setPageOrientation( QPRINTER_PORTRAIT )
      oPrinter:setPageMargins( QMarginsF( 15, 15, 15, 15 ), QPRINTER_MILLIMETER )
      oPrinter:setFullPage( .F. )
      oPrinter:setOutputFormat( QPRINTER_NATIVEFORMAT )

      oPrintPreviewDialog := QPrintPreviewDialog( oPrinter )
      oPrintPreviewDialog:Connect( "paintRequested(QPrinter*)", { | oPrinter | PrintPage( oPrinter ) } )
      oPrintPreviewDialog:Exec()

return nil

function PrintPage( oPrinter )

      local oPainter

      oPainter = QPainter()
      oPainter:Begin( oPrinter )
      oPainter:DrawText( 100, 100, "Some text" )
      oPainter:End()

return nil


Image

Muchas gracias a Cristian Francolino por su gran ejemplo en el google group de qtcontribs:
https://groups.google.com/d/msg/qtcontribs/ftmFJn_py-k/v5zUyVfCBAAJ
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveTouch

Who is online

Users browsing this forum: No registered users and 6 guests