Printing with FiveTouch

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Printing with FiveTouch

Post by Antonio Linares »

You need to download the new FiveTouch.apk version from here:

https://github.com/FiveTechSoft/fivetou ... r/download

print01.prg

Code: Select all

#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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Printing with FiveTouch

Post by Antonio Linares »

A real example:

QT print defines are here:
https://doc.qt.io/archives/qt-4.8/qprinter.html

print02.prg

Code: Select all

#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

Many thanks to Cristian Francolino for his great example on qtcontribs google group:
https://groups.google.com/d/msg/qtcontr ... zUyVfCBAAJ
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply