Hello
Actually I am trying to merge 2 documents. Before merging these documents looks fine. But when I try to merge it, after merge it gets disturbed. Like header part is disturbed merged output. I have also added part of my code.
$coverPagePDF = $INPUT_DIRECTORY . 'cover.docx';
$indexPagePDF = $INPUT_DIRECTORY . 'glossary.docx';
if (file_exists($coverPagePDF)) {
mLog("Cover Page found. Adding to merge process\n");
$mergeResult = $merge->mergeDocx($coverPagePDF, array(), $OUTPUT_DIRECTORY . $OUTPUT_FILE, array('mergeType' => 0));
if (!$mergeResult) {
mLog("Merge failed for cover page\n");
return;
}
$filesAdded[] = $coverPagePDF;
} else {
mLog("Cover Page not found\n");
}
// Merge index page separately if it exists
if (file_exists($indexPagePDF)) {
mLog("Glossary Page found. Adding to merge process\n");
$mergeResult = $merge->mergeDocx($OUTPUT_DIRECTORY . $OUTPUT_FILE, array($indexPagePDF), $OUTPUT_DIRECTORY . $OUTPUT_FILE, array('mergeType' => 0));
if (!$mergeResult) {
mLog("Merge failed for Glossary page\n");
return;
}
$filesAdded[] = $indexPagePDF;
} else {
mLog("Glossary Page not found\n");
}