PDF Include Text Positioning Quirk

JamesBowen

19+ years progress programming and still learning.
I have the following code to set the X and Y positions and then uses the pdf_Text procedure output a string of text.

I could have completely misunderstand of what pdf_set_textX & pdf_set_textY do.

Running the pdf_set_textX & pdf_set_textY don't seam to do anything to affect the positioning of the outputted text.

Code:
{pdf_inc.i }

RUN pdf_new ("Spdf","./X-POS-TEST.pdf").
RUN pdf_new_page("Spdf").

RUN pdf_set_textX("Spdf", 10).
RUN pdf_text("Spdf", "Test 1. I should be at column 10 pdf_TextX=" + STRING(pdf_TextX("Spdf"))).

RUN pdf_skip("Spdf").

RUN pdf_set_textX("Spdf", 200).
RUN pdf_text("Spdf", "Test 2. I should be at column 200 pdf_TextX=" + STRING(pdf_TextX("Spdf"))).

RUN pdf_skip("Spdf").

RUN pdf_set_textY("Spdf", 50).
RUN pdf_text("Spdf", "Test 3. I should on Row 50 pdf_TextY=" + STRING(pdf_TextY("Spdf")) ).


RUN pdf_skip("Spdf").
RUN pdf_skip("Spdf").

DEFINE VARIABLE iYLoop AS INTEGER     NO-UNDO.
DEFINE VARIABLE iXLoop AS INTEGER     NO-UNDO.

DO iYloop = 1 TO 10:

  RUN pdf_set_textY("Spdf", iYloop).

  DO iXLoop = 1 TO 10:
  
    RUN pdf_set_textX("Spdf", iXLoop).      
    
    RUN pdf_text("Spdf", STRING(iYloop * iXLoop)).

    MESSAGE STRING(iYloop * iXLoop).

  END.
END.

RUN pdf_close("Spdf").
 
It's been a while since I have used the PDF features so am not completely sure. RUN pdf_set_textY("Spdf", 50) looks to be okay and from memory should start quite low down on the page. I don't think I ever used pdf_set_textX but I seem to remember for positioning columns I used pdf_text_at. E.g.:-

RUN pdf_text_at ("Spdf","Column 10",10).

Also, does something like RUN pdf_text_xy ("Spdf","Page:",400,700) ensure the X an Y are correct?

Hope this helps.
 
Back
Top