Is it possible to use an external .p to add additional content?

Hi All,

Just wondering is it possible to start a pdfinclude file in one .p then run another .p to generate some content? My program just seems to output whatever the first procedure has done nothing of the second, it doesnt look like i can define a shared stream within the pdfinc. I am using the latest version of pdfinc with progress version 10.2c.

Thanks in Advance,

xscottehx


Comment viewing options

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

external .p

I'm not sure this is what you're looking for but I load my images once and reuse them instead of loading during every pdf build since I sometimes build up to 1000 at a time. I used a handle and a function. Here is an example. I might be missing something but this is the basic gist of it. I got most of the idea from other postings, so there is some good information out there. It's been quite awhile since I wrote it so I hope I got it right and it makes sense.

/*mainProg.p*/
DEFINE new shared VARIABLE h_PDFinc AS HANDLE NO-UNDO.
RUN initProg.p
RUN genPDF.p

/*initProg.p loads images and other repeatable pieces of the pdf form to be used later*/
DEFINE shared VARIABLE h_PDFinc AS HANDLE NO-UNDO.
ASSIGN cPdfPathFile = "/tmp/inv.pdf".
RUN pdf_new IN h_PDFinc("Spdf",cPdfPathFile).
pdf_PageHeader("Spdf",THIS-PROCEDURE:HANDLE,"PageHeader").
RUN pdf_load_image IN h_PDFinc("Spdf","IMAGE","/usr/apps/images/image.jpg").

/*genPDF.p*/
DEFINE shared VARIABLE h_PDFinc AS HANDLE NO-UNDO.
FUNCTION pdf_PageHeader RETURN LOGICAL (INPUT pdfStream AS CHARACTER,
INPUT pdfProcHandle AS HANDLE,
INPUT pdfHeaderProc AS CHARACTER):
**** code *****
END FUNCTION.
ASSIGN cPdfPathFile = "/print/inv/" + UPPER(TRIM(cINum)) + ".pdf".
RUN pdf_new IN h_PDFinc("Spdf",cPdfPathFile).
pdf_PageHeader ("Spdf",THIS-PROCEDURE:HANDLE,"PageHeader"). <-- this puts the images and anything else I loaded before in the pdf

** This is in a procedure from an include file delcared in genPDF.p which is called by the PageHeader function**
RUN pdf_place_image IN h_PDFinc_CSP("Spdf", /*pdfStream*/
"image", /*pdfImageName*/
410, /*pdfColumn */
570, /*pdfRow */
35, /*pdfWidth*/
25). /*pdfHeight*/
***
RUN pdf_close IN h_PDFinc("Spdf").

Good luck,
Pete


in the "samples" directory

Hi
I think there are some examples in the "samples" directory with more than one .p to generate a single pdf file.
IIRC there is a layer.p sample that could help you.
Just checked layer.p and it is a bit complicated but works.
However, if the same instance of pdf_inc.p is SUPER procedure of both .p you use, then it should work. No time to test though, if you try it, please keep me posted!
Regards
JC


Nice Example

Thanks JC. The layer examples work perfectly, however i dont want to have to create another new page i wanted the first procedure to open the new page then the second to then write the main content. I can do this using include files just thought it could be done using this method. No biggie. Thanks for your help.

Regards,

S