rotate print

rotate print

Postby damianodec » Fri Jul 05, 2024 8:33 am

I would like to rotate a print.

by my pgm I get this print:
Image

and I would like this:
Image

I don't want to change the whole program

is there any printer method or function in Printer class?

Thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: rotate print

Postby paquitohm » Fri Jul 05, 2024 11:05 am

What I would do is:

Code: Select all  Expand view
mogrify.EXE -rotate 180 fileNNN.emf




*mogrify.exe from ImageMagick graphic pack
paquitohm
 
Posts: 257
Joined: Fri Jan 14, 2022 8:37 am

Re: rotate print

Postby karinha » Fri Jul 05, 2024 3:34 pm

Mira se ayda:

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION Main()

   LOCAL oPrn, oPen, oPen2, oFont, oFontV, oFontS, oFont14V, oBrush
   LOCAL cSyntax := "Syntax :" + CRLF + ;
      "RoundBox( nTop, nLeft, nBottom, nRight, nRndW, nRndH, oPen, onBack, aText, cUnits )"
   LOCAL cText := "aText :" + CRLF + "{ cText, oFont, nClrText, [cAlign] }"

   DEFINE BRUSH oBrush FILE "..\bitmaps\backgrnd\space.bmp"

   PRINT oPrn PREVIEW

      DEFINE PEN oPen WIDTH 3 COLOR CLR_HRED OF oPrn
      DEFINE PEN oPen2 WIDTH 1 COLOR CLR_BLACK OF oPrn

      DEFINE FONT oFontS   NAME "ARIAL" SIZE 0, - 12 OF oPrn
      DEFINE FONT oFont    NAME "ARIAL" SIZE 0, - 20 OF oPrn
      DEFINE FONT oFontV   NAME "ARIAL" SIZE 0, - 20 BOLD NESCAPEMENT 900 OF oPrn
      DEFINE FONT oFont14V NAME "ARIAL" SIZE 0, - 14 NESCAPEMENT 900 OF oPrn

      PAGE

         oPrn:RoundBox( 1.0, 1.0, 2.0, 7.5, 0.4, 0.4, oPen, CLR_YELLOW, ;
            { "HORIZONTAL" + CRLF + FWVERSION, { oFont, oFontS }, CLR_HRED }, "INCHES" )

         oPrn:RoundBox( 2.2, 1.0, 4.2, 2.0, 0.2, 0.2, oPen, CLR_GRAY,  ;
            { "VERTICAL" + CRLF + "TEXT", oFontV, CLR_YELLOW }, "INCHES" )

         oPrn:RoundBox( 5.9, 1.5, 7.1, 2.1, 0.1, 0.1, oPen2, CLR_HGRAY, ;
            { "Faturas", oFont14V, CLR_BLACK }, "INCHES" )

         oPrn:RoundBox( 7.1, 1.5, 8.3, 2.1, 0.1, 0.1, oPen2, CLR_HGRAY, ;
            { "Cálculo" + CRLF + "Imposto", oFont14V, CLR_BLACK }, "INCHES" )

         oPrn:RoundBox( 8.3, 1.5, 10.2, 2.1, 0.1, 0.1, oPen2, CLR_HGRAY, ;
            { "Transportador", oFont14V, CLR_BLACK }, "INCHES" )

         oPrn:RoundBox( 2.2, 3.0, 4.2, 7.5, 0.3, 0.3, oPen, oBrush, ;
            { cSyntax, oFont, CLR_BLACK }, "INCHES" )

         oPrn:RoundBox( 9, 1, 5, 5, .5, .5, { CLR_MAGENTA, 3 }, oBrush,          ;
            { "FIRST" + CRLF + "SECOND", oFont, CLR_WHITE, "B" }, ;
            "INCHES" )

         oPrn:RoundBox( 4.4, 3.0, 5.9, 7.5, 0.3, 0.3, oPen, CLR_WHITE, ;
            { cText, oFont, CLR_BLACK }, "INCHES" )

      ENDPAGE

   ENDPRINT

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: rotate print

Postby nageswaragunupudi » Sun Jul 07, 2024 8:21 am

paquitohm wrote:What I would do is:

Code: Select all  Expand view
mogrify.EXE -rotate 180 fileNNN.emf




*mogrify.exe from ImageMagick graphic pack


Thanks. Good information.
Let us try if our FWH can do some Magic like ImageMagick :D
Regards

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

Re: rotate print

Postby nageswaragunupudi » Sun Jul 07, 2024 8:26 am

I don't want to change the whole program


Well, we can write a new program with Escaped fonts and printing from bottom to right.
But you do not want to change or re-write your program.

Assume that this is your original progam:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

  local oPrn, oFont, n

   PRINT oPrn PREVIEW
   oPrn:SetPage( 9 ) // A4
   DEFINE FONT oFont NAME "IMPACT" SIZE 0,-80 OF oPrn
   PAGE
   for n := 1 to 9
      @ n, 1 PRINT TO oPrn TEXT NTOCMONTH( n ) SIZE 6,1 INCHES FONT oFont ALIGN ""
   next
   ENDPAGE
   ENDPRINT
   RELEASE FONT oFont

return nil
 


I suggest you make these two minor changes:
Change:
Code: Select all  Expand view
PRINT oPrn PREVIEW

as
Code: Select all  Expand view
PRINT oPrn FILE "t.png"

Then call the function RotatePrint( cPreview ) at the end like this:
Code: Select all  Expand view
RotatePrint( "t.png" )


I will also provide the source code of the function RotatePrint()

Now your program looks like this:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oPrn, oFont, n

   // Original Print program
   PRINT oPrn FILE "t.png"   // add FILE "t.png"
   oPrn:SetPage( 9 ) // A4
   DEFINE FONT oFont NAME "IMPACT" SIZE 0,-80 OF oPrn
   PAGE
   for n := 1 to 9
      @ n, 1 PRINT TO oPrn TEXT NTOCMONTH( n ) SIZE 6,1 INCHES FONT oFont ALIGN ""
   next
   ENDPAGE
   ENDPRINT
   RELEASE FONT oFont
   // End: Original Print Program

   RotatePrint( "t.png" )

return nil

function RotatePrint( cPreview )

   local oPrn, hBmp, hBmpR

   hBmp  := FW_ReadImage( nil, cPreview )[1]
   hBmpR := RotateBmp( hBmp, 180, CLR_WHITE )
   palbmpfree( hBmp )

   PRINT oPrn PREVIEW
   oPrn:SetPage( 9 ) // A4
   PAGE
   @ 0,0 PRINT TO oPrn IMAGE hBmpR
   ENDPAGE
   ENDPRINT

return nil


Image

So, now our new function RotatePrint() does what
Code: Select all  Expand view
mogrify.EXE -rotate 180 fileNNN.emf

does.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests

cron