XML API - pdx:mergePdf

pdx:mergePdf

Merges two or more PDF documents.

Note

You are reading the XML API documentation. For the PHP API method please go to mergePdf.

Description

Element definition

7
 
1
<pdx:utilities>
2
    <pdx:mergePdf pdx:target="" pdx:annotations="">
3
        <pdx:pdf pdx:path="" />
4
        <pdx:pdf pdx:path="" />
5
    </pdx:mergePdf>
6
</pdx:utilities>
7

This element allows the full merging of PDF documents.

Attributes and sub-elements

target

The destination path of the merged file.

annotations

Import annotations (links, comments and others).

Code samples

Example #1

config.xml

7
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:config>
4
        <pdx:output pdx:name="output" pdx:type="docx" />
5
    </pdx:config>
6
</pdx:document>
7

content.xml

11
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:utilities>
4
        <pdx:mergePdf pdx:target="/var/www/phpdocx/samples/DocxUtilities/mergePdf/output_merged.pdf">
5
            <pdx:pdf pdx:path="/var/www/phpdocx/samples/files/Test.pdf" />
6
            <pdx:pdf pdx:path="/var/www/phpdocx/samples/files/Test2.pdf" />
7
            <pdx:pdf pdx:path="/var/www/phpdocx/samples/files/Test3.pdf" />
8
        </pdx:mergePdf>
9
    </pdx:utilities>
10
</pdx:document>
11

settings.xml

6
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:settings>
4
    </pdx:settings>
5
</pdx:document>
6

PHP code

x
 
1
require_once 'path_to_phpdocx/classes/CreateDocx.php';
2
3
$docx = new XMLAPI('config.xml');
4
$docx->setDocumentProperties('settings.xml');
5
$docx->addContent('content.xml');
6
7
$docx->render();
­
­