Well, it compiles and it works... but there are some strangeness in the code....
AAAA)
Start with this code snippet:
#ifdef __XPP__
METHOD tPdf:SetLPI(_nLpi)
#else
METHOD SetLPI(_nLpi)
#endif
local cLpi := alltrim(str(_nLpi))
DEFAULT _nLpi TO 6
cLpi := iif(cLpi$"1;2;3;4;6;8;12;16;24;48",cLpi,"6")
::aReport[ LPI ] := val( cLpi )
::PageSize( ::aReport[ PAGESIZE ] )
RETURN
_nLpi is used BEFORE assigning it a default value...
then ::PageSize( ::aReport[ PAGESIZE ] ) is called, but this method
has no use of LPI !
BBBB)
SetLPI is called only once in the code, here:
::PageSize( _cPageSize ) // sets page width and height
::PageOrient( _cPageOrient ) // sets page orientation and the
CALLS PageSize... correctly because you may have rotated the paper
::SetLPI( _nLpi ) // sets the LPI and then CALLS PageSize.... but
the results doesn't change because LPI value is not used....
Probably a refactoring could be:
::SetLPI( _nLpi ) // removing the call to PageSize
::PageOrient( _cPageOrient ) // sets page orientation AND CALLS
PageSize... since PageOrient is a public method, it is correct that it
calls correctly because you may have rotated the paper
But since PageOrient is PUBLIC, I can call it also in the middle of a
page.... can I ? Later I will try the effect....
A better refactoring could be:
::SetLPI( _nLpi ) // removing the call to PageSize
make PageOrient a PROTECTED method (it's called only once)
::PageOrient( _cPageOrient )
::PageSize( _cPageSize )
CCCC)
What puzzled me the most, I spent some time trying to understand why
my A4 pdf looked strange when I called PageSize( "A4").... and found
this code:
METHOD PageSize( _cPageSize )
#endif
local nSize, aSize := { { "LETTER", 8.50, 11.00 }, ;
{ "LEGAL" , 8.50, 14.00 }, ;
{ "LEDGER", 11.00, 17.00 }, ;
{ "EXECUTIVE", 7.25, 10.50 }, ;
{ "A4", 8.27, 11.69 }, ;
{ "A3", 11.69, 16.54 }, ;
{ "JIS B4", 10.12, 14.33 }, ;
{ "JIS B5", 7.16, 10.12 }, ;
{ "JPOST", 3.94, 5.83 }, ;
{ "JPOSTD", 5.83, 7.87 }, ;
{ "COM10", 4.12, 9.50 }, ;
{ "MONARCH", 3.87, 7.50 }, ;
{ "C5", 6.38, 9.01 }, ;
{ "DL", 4.33, 8.66 }, ;
{ "B5", 6.93, 9.84 } }
DEFAULT _cPageSize TO "LETTER"
nSize := ascan( aSize, { |arr| arr[ 1 ] = _cPageSize } )
IF nSize == 0 .or. nSize > 2 // HERE IS THE PROBLEM.....
nSize := 1
ENDIF
It seems that I can only have LETTER pdf....
So, after a couple of days spent on this library that looked
interesting, I think I will give up.... it may have some other
"hidden" features...
What's your idea ?
Francesco
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour