Recent methods oPrn:PrintImage and oPrnLSayText

Recent methods oPrn:PrintImage and oPrnLSayText

Postby nageswaragunupudi » Mon May 02, 2016 3:38 am

It appears to me that the recently introduced methods PrintImage and SayText of TPrinter class have gone mostly unnoticed.

For those who like, I suggest trying this sample program:
Code: Select all  Expand view
#include "fivewin.ch"

//----------------------------------------------------------------------------//
function Main()

   local aText[ 4 ], oPrn, oFont
   local nMargin, nGutter, nWidth, nColWidth
   local nRow, nCol

   TEXT INTO aText[ 1 ]
   Powerful typhoon Koppu ploughed into the northeasten Philppines before dawn on Sunday destroying homes and displacing 10,000 people and whipping up coastal surges four metres high.

   ENDTEXT

   TEXT INTO aText[ 2 ]
   ఉత్తరప్రదేశ్‌లోని నోయిడాలో ఉన్న అమిత్ యూనివర్సిటీలో ఓ తెలుగు విద్యార్ధి దారుణ హత్యకు గురయ్యాడు. స్నేహితులే అతడిని కాల్చి చంపినట్లు తెలుస్తోంది. మృతుడు నల్గొండ పట్టణంలోని శ్రీనగర్ కాలనీకి చెందిన సందేశ్ భాస్కర్ (23)గా గుర్తించారు. సందేశ్ భాస్కర్ నోయిడాలోని అమిత్ యూనివర్సిటీలో బీఎస్సీ మెరైన్ సైన్స్

   ENDTEXT

   TEXT INTO aText[ 3 ]
   I'm hoping that every good film is a commercial film. Every good film should be a commercial film. And my definition of commercial is that if the film goes out and people engage in it and it earns money, then it is a commercial film," said Anurag Kashyap.

   ENDTEXT

   TEXT INTO aText[ 4 ]
   लेखकों द्वारा साहित्य अकादमी सम्मान लौटाने के क्रम में एक नाटकीय मोड़ तब आ गया जब उर्दू के मशहूर शायर मुनव्वर राणा ने टीवी पर सीधे प्रसारण के दौरान अपना साहित्य अकादमी सम्मान लौटा दिया और साथ में एक लाख रूपये का चेक भी दिया। राणा ने घोषणा की कि वह भविष्य में किसी भी तरह का सरकारी सम्मान ग्रहण नहीं करेंगे। समकालीन उर्दू कविता के एक बड़े नाम राणा आज टेलीविजन पर एक कार्यक्रम में भाग ले रहे थे। इसमें कई लेखक और राजनेता भी शामिल हुए। इसी दौरान राणा ने कहा कि उन्होंने अपना सम्मान लौटाने का निर्णय लिया है और वह वर्तमान में देश के हालात से क्षुब्ध हैं। राणा ने कहा

   ENDTEXT

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-12 OF oPrn

   nMargin     := Int( 0.1 * oPrn:nHorzRes() )
   nWidth      := 8 * nMargin
   nColWidth   := Int( ( nWidth - nMargin ) / 2 )


   PAGE
   nRow        := 100
   nRow        := oPrn:SayText( nRow, nMargin, aText[ 1 ], nColWidth, nil, oFont )
   nRow        += 20
   nRow        := oPrn:PrintImage( nRow, nMargin, "c:\fwh\bitmaps\olga1.jpg", nColWidth, 2000 )
   nRow        += 40
   nRow        := oPrn:SayText( nRow, nMargin, aText[ 2 ], nColWidth, nil, oFont )
   nRow        += 20
   nRow        := oPrn:PrintImage( nRow, nMargin, "koala.jpg", nColWidth, 1500 )


   nRow        := 100
   nCol        := nMargin + nColWidth + nMargin
   nRow        := oPrn:SayText( nRow, nCol, aText[ 3 ], nColWidth, nil, oFont )
   nRow        += 20
   nRow        := oPrn:PrintImage( nRow, nCol, "eiphil.jpg", nColWidth, nil )
   nRow        += 40
   nRow        := oPrn:SayText( nRow, nCol, aText[ 1 ], nColWidth, nil, oFont )
   nRow        += 20
   nRow        := oPrn:PrintImage( nRow, nCol, "\fwh\bitmaps\alphabmp\design.bmp", nColWidth, 600 )
   nRow        += 40
   nRow        := oPrn:SayText( nRow, nCol, aText[ 4 ], nColWidth, nil, oFont )

   ENDPAGE
   ENDPRINT

return nil

I used some jpg's which are not available in the fwh\samples folder. You may substitute with your own jpgs or other image files.

Image

I hope you will notice much better quality of printing.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10326
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 133 guests