Skip to content

Function: mergePdfs()

ts
function mergePdfs(files: MwFile[]): Promise<MwFile>;

Defined in: src/file/pdf.ts:406

Merge multiple PDF files into a single file.

Pages appear in the order the files are provided.

Parameters

ParameterTypeDescription
filesMwFile[]The PDF MwFiles to merge.

Returns

Promise<MwFile>

A new MwFile containing all pages from every input file.

Example

ts
const cover = convertBase64ToMwFile(coverBase64, 'cover.pdf', 'application/pdf');
const body = convertBase64ToMwFile(bodyBase64, 'body.pdf', 'application/pdf');
const merged = await mergePdfs([cover, body]);
console.log(merged.name); // 'merged-20240115120000.pdf'

Matterway Assistant SDK Documentation