Mr. Nages please: HARU PDF Bugs/Extensions

Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Sun Jan 26, 2020 2:31 pm

Not functioning:
Code: Select all  Expand view  RUN
oPrn:say(nRow,nCol,cText,oFont,,,,1)
oPrn:say(nRow,nCol,cText,oFont,,,,2)


To add in Tpdf:
Code: Select all  Expand view  RUN
  DATA nXoffset INIT 0
   DATA nYoffset INIT 0


To add oPrn:Sayimage(…) as this is better quality as oPrn:Saybitmap(...)
Last edited by byte-one on Thu Feb 13, 2020 1:13 pm, edited 1 time in total.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: HARU PDF Bugs/Extensions

Postby byte-one » Wed Feb 05, 2020 11:28 am

Please Mr. Nages, show to that!
Thanks
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Thu Feb 13, 2020 1:14 pm

Mr. Nages, have you any answer?
Thanks
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Thu Feb 13, 2020 1:41 pm

please wait
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Thu Feb 27, 2020 1:11 pm

Mr. Nages, is this corrected in 20.02?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Mon Mar 02, 2020 4:10 pm

As workaround in fwpdf.prg i make this correction:
Code: Select all  Expand view  RUN

....
DEFAULT nWidth :=  0
....  
DO CASE
   CASE nPad == NIL .OR. nPad == HPDF_TALIGN_LEFT //.OR. Empty( nWidth )   //removed
....

and now is functioning.
But this is not correct code, as nWidth is not respected as in printer.prg!!!!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Tue Mar 03, 2020 5:51 am

This is a working sample, without any changes to the FWH libraries:
Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "report.ch"

REQUEST FWHARU

function Main()

   local oPrn, oFont, oPen
   local cPdfFile

   TPrinter():lUseHaruPDF  := .t.
   cPdfFile := "test.pdf"

   PRINT oPrn PREVIEW FILE cPdfFile
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-20 OF oPrn
   DEFINE PEN oPen WIDTH 1 OF oPrn

   PAGE

   oPrn:RoundBox( 3, 2.5, 9, 12.5, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
   oPrn:Say( 4, 2.5,   "Left at 4 cm",     oFont, 10, nil, nil, 0, "CM" )
   oPrn:Say( 5, 2.5,   "Right at 5 cm",    oFont, 10, nil, nil, 1, "CM" )
   oPrn:Say( 6, 2.5,   "Centered at 6 cm", oFont, 10, nil, nil, 2, "CM" )
   oPrn:Say( 3, 0.984, "Left at 3 inches", oFont, 10, nil, nil, 0, "INCHES" )

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE PEN  oPen

return nil
 


Image

If instead of
Code: Select all  Expand view  RUN

   cPdfFile := "test.pdf"
 

cPdfFile is set to NIL, the output will go to print preview.
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Tue Mar 03, 2020 9:40 am

Please try without nWidth!
Code: Select all  Expand view  RUN
oPrn:RoundBox( 3, 2.5, 9, 12.5, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
   oPrn:Say( 4, 2.5,   "Left at 4 cm",     oFont, , nil, nil, 0, "CM" )
   oPrn:Say( 5, 2.5,   "Right at 5 cm",    oFont, , nil, nil, 1, "CM" )
   oPrn:Say( 6, 2.5,   "Centered at 6 cm", oFont, , nil, nil, 2, "CM" )
   oPrn:Say( 3, 0.984, "Left at 3 inches", oFont, , nil, nil, 0, "INCHES" )
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Tue Mar 03, 2020 10:08 am

If we do not provide width, the text is aligned left.
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Tue Mar 03, 2020 10:11 am

byte-one wrote:As workaround in fwpdf.prg i make this correction:
Code: Select all  Expand view  RUN

....
DEFAULT nWidth :=  0
....  
DO CASE
   CASE nPad == NIL .OR. nPad == HPDF_TALIGN_LEFT //.OR. Empty( nWidth )   //removed
....

and now is functioning.
But this is not correct code, as nWidth is not respected as in printer.prg!!!!


nWidth is respected.
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Tue Mar 03, 2020 11:23 am

Sorry, but this is not compatible with printer.prg!! I never use nWidth and then the align right or center are not respected.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Thu Mar 05, 2020 5:18 am

To add oPrn:Sayimage(…) as this is better quality as oPrn:Saybitmap(...)


We recommend using oPrn:PrintImage(...) introduced in FWH1510 and enhanced in FWH1604 for all future developments.

This method supersedes both the old methods SayBitmap() and SayImage(), which exist to support legacy applications created prior to 2016. These methods may be treated as deprecated for future development.

Syntax:
Code: Select all  Expand view  RUN

METHOD PrintImage( nRow, nCol, uImage, nWidth, nHeight, lStretch, nAlpha, lTransp, lGray, cUnits, cAlign, cURL )
 

FWPdf ignores nAlpha, lTransp and lGray
TPrinter ignores cURL

1,2,4,5) nRow, nCol, nWidth, nHeight specify the bounding rectangle.
3) uImage is any image source.
4) lStretch. If true, the image is stretched to fill the rectangle, ignoring the aspect ratio. Default is .f.
In this case, the image is shrunk if width or height exceeds the size of the rectangle and centered inside the rectangle (if cAlign is nil)
10) cUnits can be "MM", "CM", "INCHES". It is highly recommended not to use pixels to have compatibility between printer and fwpdf.
11) cAlign: Combination of "T" for top or "B" for bottom combined with "L" for left or "R" for right. Eg: "TL", "BR", etc. If not speicified the image is centered.
12) cURL: Ignored by TPrinter. In case of FWPdf, if a URL is specified, clicking on the image on the pdf will navigate to the URL.
Example: Build pdfharu1.prg and click on olga's image.

We highly recommend using the command syntax for this method:
Code: Select all  Expand view  RUN

#xcommand @ <nRow>, <nCol> PRINT TO <prn> IMAGE <img> ;
      [SIZE <nWidth> [,<nHeight>] ] ;
      [<unit: PIXEL,MM,CM,INCHES,SCREEN>] ; // do not use PIXEL/SCREEN
      [<lStr: STRETCH>] ;
      [ ALPHALEVEL <nAlpha>] ; // ignored by fwpdf
      [<lNoTrn: NOTRANSPARENT>] ; // ignored by fwpdf
      [<lGray: GRAY> ] ;  // ignored by fwpdf
      [ALIGN <aln>] ;
      [URL <cURL> ] ; // ignored by TPrinter
      [LASTROW <lrow>] ;
   => ;
      [<lrow> := ] <prn>:PrintImage( <nRow>, <nCol>, <img>, [<nWidth>], [<nHeight>], ;
            [<.lStr.>], [<nAlpha>], [!<.lNoTrn.>], [<.lGray.>], [<(unit)>], [<aln>], [<cURL>] )
 
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Thu Mar 05, 2020 11:12 am

To add in Tpdf:
Code:
DATA nXoffset INIT 0
DATA nYoffset INIT 0


May we know why these DATA are necessary. All methods are working without any errors without these DATAs
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby nageswaragunupudi » Thu Mar 05, 2020 11:18 am

Now, reviewing the issue of compatibility of the behavior of the method Say() when nWidth parameter is nil and nPad is Right/Center.

This program shows the difference in the behaviour.
Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "report.ch"

REQUEST FWHARU

function Main()

   local oPrn, oFont, oPen, nWidth
   local cPdfFile

   TPrinter():lUseHaruPDF  := .t.

   if MsgYesNo( "Output to PDF?" )
      cPdfFile := "test.pdf"
   endif

   PRINT oPrn PREVIEW FILE cPdfFile
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-14 BOLD OF oPrn
   DEFINE PEN oPen WIDTH 1 OF oPrn

   PAGE

   nWidth   := 14

   oPrn:Say( 1, 3, If( cPdfFile == nil, "TPrinter", "FWPdf" ), oFont, nil, nil, nil, 0, "CM" )
   oPrn:Say( 2, 3, "Method Say() with nWidth param = 14 cm", oFont, nil, nil, nil, 0, "CM" )

   oPrn:RoundBox( 3, 3, 7, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
   oPrn:Say(  4, 3, "LEFT ALIGNED TEXT WIDTH 14 CM",   oFont, nWidth, nil, nil, 0, "CM" )
   oPrn:Say(  5, 3, "RIGHT ALIGNED TEXT WIDTH 14 CM",  oFont, nWidth, nil, nil, 1, "CM" )
   oPrn:Say(  6, 3, "CENTERED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 2, "CM" )

   nWidth   := nil

   oPrn:Say(  8, 3, "Method Say() with nWidth param = nil" + ;
      If( cPdfFile == nil, "", " : FWPdf ignores Alignment" ), oFont, nil, nil, nil, 0, "CM" )
   oPrn:RoundBox( 9, 3, 13, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
   oPrn:Say( 10, 3, "LEFT ALIGNED TEXT WIDTH NIL",   oFont, nWidth, nil, nil, 0, "CM" )
   oPrn:Say( 11, 3, "RIGHT ALIGNED TEXT WIDTH NIL",  oFont, nWidth, nil, nil, 1, "CM" )
   oPrn:Say( 12, 3, "CENTERED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 2, "CM" )

   if cPdfFile == nil
   oPrn:Say( 15, 3, "LEFT   Align: Prints text to the RIGHT of nCol", oFont, nil, nil, nil, 0, "CM" )
   oPrn:Say( 16, 3, "RIGHT  Align: Prints text to the LEFT  of nCol", oFont, nil, nil, nil, 0, "CM" )
   oPrn:Say( 17, 3, "CENTER Align: Prints text CENTERED around nCol", oFont, nil, nil, nil, 0, "CM" )
   endif

   oPrn:RoundBox( 18, 3, 22, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
   oPrn:Say( 19, 3, "LEFT",   oFont, nWidth, nil, nil, 0, "CM" )
   oPrn:Say( 20, 3, "RIGHT",  oFont, nWidth, nil, nil, 1, "CM" )
   oPrn:Say( 21, 3, "CENTER", oFont, nWidth, nil, nil, 2, "CM" )

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE PEN  oPen

return nil
 


FWPDF:
Image

TPRINTER class
Image

What is your advice now please?
Regards

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

Re: Mr. Nages please: HARU PDF Bugs/Extensions

Postby byte-one » Thu Mar 05, 2020 12:06 pm

Please make the same behavour in both classes as i print out the same document to printer and make a pdf with haru.
In Tprinter you have in code from ::say(...)
Code: Select all  Expand view  RUN
if empty(nWidth)
    ....LEFT
    ....Right
    ...center
else   //nWidth are NOT empty
    ....same as now in fwpdf only
endif

The same logic you should use in fwpdf!

To add in Tpdf:
Code:
DATA nXoffset INIT 0
DATA nYoffset INIT 0

For Tprinter it is nessacary to use this for check the first pixel the printer are able to print. These datas are only required for compatibility from code.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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