A Question to PDFinclude users / "TABLE TOOL"

Posted by teppo_55 on 23-Feb-2017 06:24

I want to use "TABLE TOOL" because I have a variable number of lines and pages.

I write a header, which on the first page has more lines than on other pages.  No

problems: "TABLE TOOL" works well.

The problem is after the table, where I should write lines on the last page:

The text goes inside the table cells as the last line of table (variable height?), when I use the outline:
RUN pdf_set_tool_parameter("Spdf","report1","Outline",0,".1").

I would like to stop the table outline after RUN pdf_tool_create.

The texts after the table should go to an empty space.  
How can I make this (without using MATRIX TOOL)?

Regards

- teppo

All Replies

Posted by Jean-Christophe Cardot on 06-Mar-2017 03:12

Hi Teppo

I'm the maintainer for pdfInclude. Sorry I've not seen your question before.

There is a final outlining in pdf_inc.p (called from pdf_close), which will then outline as far as pdf_textY().

So if you restore pdf_textY() before pdf_close, like the following:

 RUN pdf_tool_create ("Spdf","CustList").

 DEFINE VARIABLE deY AS DECIMAL     NO-UNDO.

 deY = pdf_textY("Spdf"). /* saving the Y position */

 RUN pdf_skipn ("Spdf", 3). /* inserting some space */

 RUN pdf_text ("Spdf", "jice was here"). /* writing my text */

 RUN pdf_set_textY("Spdf", deY). /* restoring the Y position to that it was afterr pdf_tool_create */

 RUN pdf_close("Spdf").

Then the table outline should not go past the end of the table anymore.

Hope this helps.

Regards

JC

PS : just noticed however that if the text you add goes beyond the end of page, thus triggers the creation of a new page, then there will still be some outlining...

Posted by Jean-Christophe Cardot on 06-Mar-2017 04:01

Following up...

With pdfInclude 5.1, as I have more published events, I can fix this, doing this:

-------------------

SUBSCRIBE TO "finishPdfPage" IN h_PDFInc.

SUBSCRIBE TO "generatePdfPage" IN h_PDFInc.

/* Now produce the table */

RUN pdf_tool_create ("Spdf","CustList").

DEFINE VARIABLE deY AS DECIMAL     NO-UNDO.

DEFINE VARIABLE ddd AS DECIMAL     NO-UNDO.

DEFINE VARIABLE iPage AS INTEGER     NO-UNDO.

deY = pdf_textY("Spdf").

iPage = pdf_page("Spdf").

RUN pdf_skipn ("Spdf", 3).

RUN pdf_wrap_text("spdf", FILL("jice was here ", 40), 5,80,  "LEFT", OUTPUT ddd).

RUN pdf_close("Spdf").

IF RETURN-VALUE > '' THEN

   MESSAGE RETURN-VALUE

       VIEW-AS ALERT-BOX ERROR BUTTONS OK.

PROCEDURE finishPdfPage:    

   DEFINE INPUT  PARAMETER pdfStream AS CHARACTER   NO-UNDO.

   DEFINE INPUT  PARAMETER pdfPage AS INTEGER     NO-UNDO.

   RUN pdf_set_textY("Spdf", IF pdfPage = iPage THEN deY ELSE pdf_pageheight(pdfStream) - pdf_topmargin(pdfStream)).

END PROCEDURE.

PROCEDURE generatePdfPage:    

   DEFINE INPUT  PARAMETER pdfStream AS CHARACTER   NO-UNDO.

   DEFINE INPUT  PARAMETER pdfPage AS INTEGER     NO-UNDO.

   IF pdfPage > iPage THEN RUN pdf_skip(pdfStream).

END PROCEDURE.

-------------------

but I think you will miss the finishPdfPage event in your version.

what it does here is to ensure the outline won't go past the last line of the table; in case the added text triggers the creation of a new page, there won't be any outline either on the new page. The table header is still printed on the new page though.

Posted by Jean-Christophe Cardot on 24-Mar-2017 11:33

Hi Teppo

Did this help?

Regards

JC

Posted by James Palmer on 24-Mar-2017 12:34

 
 

This thread is closed