I can't get pdf_pageHeader to work - what am I doing wrong?

I took the example of how to implement page headers & footers directly from the PDFinclude PRO v1 Documentation and from the table.p sample program.

My code is as follows:
{pdf/pdf_inc.i }

RUN Create-pdf.
PROCEDURE Create-pdf:

RUN pdf_new ("Spdf", "tmp/pdfTest.pdf").
RUN pdf_set_Orientation ("Spdf", "Portrait").
RUN pdf_set_LeftMargin ("Spdf", "10").
RUN pdf_set_PaperType ("Spdf", "LETTER").
RUN pdf_new_page ("Spdf").
message 'i am here ' this-procedure:handle VIEW-AS ALERT-BOX.
pdf_PageHeader ("Spdf",THIS-PROCEDURE:HANDLE, "PageHeader").
RUN pdf_text_at ("Spdf", 'THIS IS A TEST', 10).
RUN pdf_skip("Spdf").

RUN pdf_set_font ("Spdf","COURIER",8.0).
FOR EACH soln WHERE so-nbr = 2781330 NO-LOCK:
RUN pdf_text_at
("Spdf",
(STRING(soln.so-nbr) + ' ' + STRING(soln.itm-nbr) + ' ADJUSTED'),
5).
RUN pdf_skip ("Spdf").
END.
RUN pdf_close ("Spdf").
END. /*create-and-email-pdf*/

PROCEDURE PageHeader:

DEF VAR L-hdrLn1 AS C FORMAT 'X(300)'.

L-hdrLn1 = '(soshpadj) ' + G-loginID + 'SO ADJUSTED REPORT' + ' PAGE: ' +
STRING(pdf_page("Spdf")) +
" of " + pdf_TotalPages("Spdf").

RUN pdf_set_font ("Spdf","Courier-Bold",12.0).
RUN pdf_text_xy ("Spdf",L-hdrLn1,1,600).

END.

However when I print the document there is no page header, I do see my 4 lines of SO data, and the line that says "THIS IS A TEST".

I even tried to display a message while in my procedure PageHeader - but it appears to never get into the procedure...as I get no message to the screen. I've put a message in the FUNCTION call pdf_PageHeader and I do see that one. So, what am I missing?

I'm attaching the pdf file that the above code created.


AttachmentSize
pdfTest.pdf3.58 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

wrong statements order

Hi

pdf_PageHeader ("Spdf",THIS-PROCEDURE:HANDLE, "PageHeader").
must be before
RUN pdf_new_page ("Spdf").

as the pageHeader procedure is called from pdf_new_page.

Regards

Jice