Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PDF3 library issue
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01663043
Message ID:
01666876
Views:
174
>Hi Rick,
>PDF3 is derived report listener.
>All metadata (text, value, left, top, width, height) are the same for PDF3 and each report listener (base or derived).
>MartinaJ
>
>>I have discovered an issue with PDF3.PRG written by Martin Krivka in 2013: http://www.vfp.cz

Martina,

I have found what I think is another issue with this code in pdf3.prg. Can you verify?

The code is in this block:
=HPDF_Page_SetRGBFill(.hPage, m.frx.penred, m.frx.pengreen, m.frx.penblue)
=HPDF_Page_BeginText(.hPage)
for m.i=1 to alen(p)
    =HPDF_Page_TextRect(.hPage, p_left, p_top, p_right, p_bottom, p_text, m.frx._align, 0)
endfor
if bittest(m.frx.fontstyle ,2)
    private ul,ur,u,uw,underline1
    m.underline1=HPDF_Page_TextWidth(.hPage, "_")
    for m.i=1 to alen(p)
        m.u=replicate("_", int(p_width/m.underline1))
        m.uw=m.underline1*len(m.u)
        if m.uw > p_width
            m.ul=p_left - round( (m.uw - (p_right-p_left))/2, 0)
            m.ur=m.ul+m.uw
        else
            m.ul=p_left
            m.ur=p_right
        endif
        =HPDF_Page_TextRect(.hPage, m.ul, p_top-1, m.ur, p_bottom-1, m.u, m.frx._align, 0)
    endfor
endif
=HPDF_Page_EndText(.hPage)
The bug is here:
for m.i=1 to alen(p)
* Bug ... this line positions the multiple rows of data without regard to any height consideration:
    =HPDF_Page_TextRect(.hPage, p_left, p_top, p_right, p_bottom, p_text, m.frx._align, 0)
endfor
it should be like this so that lines that wrap and exceed their rectangle do not continue to be positioned on the page:
for m.i=1 to alen(p)
    IF p_top - p_height >= p_bottom   && Added
        =HPDF_Page_TextRect(.hPage, p_left, p_top, p_right, p_bottom, p_text, m.frx._align, 0)
    ENDIF   && Added
endfor
In one of our data sets, for example, we have a report that allows 1.23" for a particular column, but the data in the column is wide enough for two rows of that. Using pdf3.prg as it is it wraps the second line down and prints row 2 half over the top of the first row content. With the change above it only prints the first row, and skips over the second row because the coordinates exceed the original rectangle.

I think this may only be half a solution, however, because there should be a way to determine if the content's properties should allow wrapping or not.

What do you think?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform