PDF Include

donnabelle07

New Member
HI,

can anyone please help me on pdf include. I am trying to use a template for pdf and fill out the data on a new pdf file. However if I have 3 records the new pdf file will only create the first record.

Here is my code:

IF vcont2 = 1 THEN DO:
RUN pdf_reset_all.
RUN pdf_new("Spdf",chFile2). /* new pdf file */
END.
RUN pdf_open_PDF("Spdf",chFile,CHID). /* Open Template PDF */
RUN DoNewPage2(vCont2,CHID).
RUN pdf_close("Spdf").

PROCEDURE DoNewPage2.
DEFINE INPUT PARAMETER vcont2 AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER CH_ID AS CHARACTER NO-UNDO.
I_PAGE = I_PAGE + 1.
RUN pdf_new_page("Spdf").
RUN pdf_use_PDF_page("Spdf",vcont2,CH_ID).

RUN pdf_fill_text("Spdf", "SchoolName",chSchoolName, "Align=left").
END PROCEDURE.

Thanks,
Donna
 

Casper

ProgressTalk.com Moderator
Staff member
The idea is to use the template on every new page you make. So first you open the template with pdf_open_PDF give it a name (in my case 'TEMPLATE') and then use that template with pdf_use_PDF_page (possibly one page so I just made that the first page).

Finally if all is done close the pdf document.

Code:
IF vcont2 = 1 THEN DO:
    RUN pdf_reset_all.
    RUN pdf_new("Spdf",chFile2). /* new pdf file */
    RUN pdf_open_PDF("Spdf",chFile,'TEMPLATE'). /* Open Template PDF */
END.
RUN DoNewPage2(vCont2,CHID).
if vCont2 = last then
RUN pdf_close("Spdf").
 
PROCEDURE DoNewPage2.
DEFINE INPUT PARAMETER vcont2 AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER CH_ID AS CHARACTER NO-UNDO.
RUN pdf_new_page("Spdf").
RUN pdf_use_PDF_page("Spdf",'TEMPLATE',1). /* use the first page of the template */
/* do what you like */
END PROCEDURE.


Casper.
 
Top