=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) endforit 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 endforIn 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.