PreviousNext
Help > Programming with LAUNCHER Office > LNCCMD commands > Commands list > PDFCONCAT command
PDFCONCAT command

Allows to get concat several PDF files into a new PDF file.

 

The maximum number of PDF to concatenate with the PDFCONCAT command is 104.

You should have to increase size of Parm1 (see Example 2).

 

 

Syntax

 

CHGVAR

VAR(&CMD) VALUE('PDFCONCAT')

CHGVAR

VAR(&PARM1) VALUE('"<path_file1>.pdf";"<path_file2>.pdf";
"<path_file3>.pdf";"<path_file4>.pdf"')

CHGVAR

VAR(&PARM2) VALUE('Dest="Path of the new PDF"')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +

&PARM2 &RESULT)

 

 Parameters

 

Parameters

 

Parm1

 

 

Parm2

List of the PDF files to concat (complete path between double quotes), separated by a semicolon.

 

 

Dest: Complete path of the new PDF, corresponding to the concatenation of the PDF files contained into Parm1.

 

 

 

Example 1

 

 LNCCMD     CMD(PDFCONCAT) +                              

             PARM1('"C:\A\a.pdf";"C:\A\b.pdf";"C:\A\R_27+

             WORD.pdf";"C:\A\c.pdf"') +                  

             PARM2('Dest="C:\A\res2.pdf"')               

 

Example 2

 

You can use of the DIRLIST command to list PDFs in a directory, and send them as a parameter of PDFCONCAT.

 

In this example, the PROPERTY command was used to change the size of the Parm1, Parm2 and Result parameters, only for the current connection.

At the end of the connection, the default settings are applied.

 

PROPERTY has no effect when using LNCCMD commands. The CALL PGM (LNCCMD) program call must be used.

 

It will of course be necessary to change the size of the variables.

 

The cumulative size for Parm1 and Parm2 must not exceed 32700.

The size for Result should not exceed 32700.

 

 

 PGM

 DCL        VAR(&RES) TYPE(*CHAR) LEN(512)

 DCL        VAR(&OPT) TYPE(*CHAR) LEN(1)

 DCL        VAR(&HDL) TYPE(*CHAR) LEN(100) VALUE('*ONLY ')

 DCL        VAR(&PARM1) TYPE(*CHAR) LEN(31000)

 DCL        VAR(&PARM2) TYPE(*CHAR) LEN(1000)

 DCL        VAR(&LIST) TYPE(*CHAR) LEN(20000)

 DCL        VAR(&CNT) TYPE(*DEC) LEN(3) VALUE(0)

 DCL        VAR(&REP) TYPE(*CHAR) LEN(3000)

 

 LNCOPEN

 

 LNCCMD     CMD(PROPERTY) +

              PARM1('PARMSIZE(31000,1000,512)')

 

 CHGVAR     VAR(&REP) VALUE('C:\A\concat')

 CHGVAR     VAR(&LIST) VALUE(' ')

 CHGVAR     VAR(&PARM1) VALUE('PATTERN="*.pdf";PATH="' +

              *TCAT &REP *TCAT '"')

 CHGVAR     VAR(&PARM2) VALUE('FIRST=TRUE')

 

 CALL       PGM(LNCCMD) PARM(&HDL 'DIRLIST' &OPT &PARM1 +

              &PARM2 &RES)

 

 IF         COND(&RES *NE ' ') THEN(DO)

     CHGVAR     VAR(&LIST) VALUE(&LIST *TCAT '"' *TCAT &REP +

                 *TCAT '\' *TCAT &RES *TCAT '"')

     CHGVAR     VAR(&CNT) VALUE(&CNT + 1)

 ENDDO

 

 CHGVAR     VAR(&PARM2) VALUE('FIRST=FALSE')

 

 DOWHILE    COND(&RES *NE ' ')

 

     IF         COND(&CNT *GT 1) THEN(DO)

           CHGVAR     VAR(&LIST) VALUE(&LIST *TCAT ';"' *TCAT &REP +

                 *TCAT '\' *TCAT &RES *TCAT '"')

     ENDDO

 

     CHGVAR     VAR(&CNT) VALUE(&CNT + 1)

 

     CALL       PGM(LNCCMD) PARM(&HDL 'DIRLIST' &OPT &PARM1 +

                 &PARM2 &RES)

 ENDDO

 

 CHGVAR     VAR(&PARM1) VALUE(&LIST)

 CHGVAR     VAR(&PARM2) +

              VALUE('DEST="C:\TEMP\FINAL_CONCAT.PDF"')

 CALL       PGM(LNCCMD) PARM(&HDL 'PDFCONCAT' &OPT +

              &PARM1 &PARM2 &RES)

 LNCCLOSE

 

 ENDPGM