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

Layer or concatenate two PDF files.

 

This command can be useful to add a watermark to a PDF document. It uses LAUNCHER_PDF.

 

Syntax

 

CHGVAR

VAR(&CMD) VALUE('PDFMERGE')

CHGVAR

VAR(&PARM1) VALUE('
File="
Output file name"
;Source1="PDF Document No 1"
;Source2=
"PDF Document No 2"
[;Repeat=
True / False]
[;Above= True / False]
[;Append= True / False]
')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

&PARM2 &RESULT)

 

Parameters

 

Parameters

 

Parm1

Or

Parm2

File : Full path and name of the PDF file resulting from the merge or concatenation, which will be performed between the two files designated by "Source1" and "Source2".

 

Source1 : Path and name of the first original PDF file.

 

Source2 : Path and name of the second PDF file. This file will be the watermark, or it will be append to the end of Source1, if Append is true.

 

Repeat : If Repeat is true, and Above is true, the document Source2 will be repeated on all the pages of Source1. Else, the output file will have a watermark only on the first page.

 

Above : True for Source2 content to appear as a Source1 watermark.

 

Append : True to append contain of Source2 to Source1. No watermark will be added to the document.

 

 

 

 

Note

If Above and Append are not specified, the default True value of Above will be taken into account. We will proceed to the establishment of a watermark.

If Append=true then we will concatenate, whatever the value of Above.

 

Example 1

 

Build a temporary PDF file with word "DUPLICATA" as watermark.
Merge this PDF file with an existing file, and repeat the watermark on all the pages.

 

 

/* Open Word with a blank page */

CHGVAR

VAR(&CMD) VALUE('WORDOPEN')

CHGVAR

VAR(&PARM1) VALUE('New')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

 

 

/* Prepare the PDF driver, set watermark to "DUPLICATA" */

CHGVAR

VAR(&CMD) VALUE('PDFPRINTER')

CHGVAR

VAR(&PARM1) VALUE('File="%TEMP%\watermark.pdf" +
WMText
="DUPLICATA"')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

 

 

/* Print the blank page with PDF driver */

CHGVAR

VAR(&CMD) VALUE('WPRINT')

CHGVAR

VAR(&PARM1) VALUE('Printer=="LAUNCHER_PDF"')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

 

/* Merge "Original" and " watermark " */

CHGVAR

VAR(&CMD) VALUE('PDFMERGE')

CHGVAR

VAR(&PARM1) VALUE('File="C:\documents\result.pdf"; +
Source1="C:\Documents\original.pdf"; +
Source2="%TEMP%\watermark.pdf"; +
Repeat
=True')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

 

/* "C:\documents\result.pdf" contains "DUPLICATA"
on all the pages */

 

 

 

Example 2

 

Concatenation of a.pdf and b.pdf to create res_con.pdf.

 

   LNCCMD     CMD(PDFMERGE) +                                

                PARM1('FILE="C:\A\res_con.pdf";SOURCE1="C:\+ 

                A\a.pdf";SOURCE2="C:\A\b.pdf";APPEND=TRUE')