Last Line of File Printing Twice with PDF Include

Project:PDF Include project
Component:Code
Category:support request
Priority:normal
Assigned:jice
Status:patch (code needs work)
Description

If I use this code in a Progress program:
RUN pdf_new ("Spdf", "po5081.pdf").
RUN pdf_set_Orientation ("Spdf", "Landscape").
RUN pdf_set_LeftMargin ("Spdf", "10").
RUN pdf_set_PageWidth ("Spdf", 975).
RUN pdf_new_page ("Spdf").
INPUT FROM "/home/mbarnosk/marcs/pdf5081.txt" NO-ECHO.
REPEAT:
IMPORT UNFORMATTED v-line.
RUN pdf_text ("Spdf", v-line).
RUN pdf_skip ("Spdf").
END.
INPUT CLOSE.
RUN pdf_close ("Spdf").

The last line of the INPUT file comes out twice in the .pdf file.

To correct this I did this:
RUN pdf_new ("Spdf", "po5081.pdf").
RUN pdf_set_Orientation ("Spdf", "Landscape").
RUN pdf_set_LeftMargin ("Spdf", "10").
RUN pdf_set_PageWidth ("Spdf", 975).
RUN pdf_new_page ("Spdf").
INPUT FROM "/home/mbarnosk/marcs/pdf5081.txt" NO-ECHO.
REPEAT:
IMPORT UNFORMATTED v-line.
RUN pdf_text ("Spdf", v-line).
ASSIGN v-line = ''.
RUN pdf_skip ("Spdf").
END.
INPUT CLOSE.
RUN pdf_close ("Spdf").

using the ASSIGN of v-line to '' clears v-line so the line does not appear twice on the .pdf file.

Is there a better way to handle the double printing of the last line?


Comments

Comment viewing options

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

#1

Assigned to:Anonymous» jice

Hi
I think it has nothing to do with pdfinclude.
Try this:

INPUT FROM "/home/mbarnosk/marcs/pdf5081.txt" NO-ECHO.
OUTPUT TO "/home/mbarnosk/marcs/pdf5081-2.txt".
REPEAT:
IMPORT UNFORMATTED v-line.
PUT UNFORMATTED v-line SKIP.
END.
INPUT CLOSE.
OUTPUT CLOSE.

the resulting file should have twice the last line.
Can you please confirm?
TIA


#2

jice,

You are right. It occurs even with your suggested code, so it is not a PDF Include issue. It must have something to do with how the REPEAT statement works. Adding the ASSIGN of v-line to "" works so I will stick with that unless you have a better way to avoid the duplicate last line.

Mike.