ftos.files.mergeAsPdf
IMPORTANT!
Starting with v24.3.0, this is renamed from getMergedReport to ftos.files.mergeAsPdf.
Starting with v24.3.0, this is renamed from getMergedReport to ftos.files.mergeAsPdf.
Concatenates multiple files and returns the ID of the resulting file (saved in the file upload location). It supports only .pdf files.
This is a business logic method for business service components.
Syntax
Copy
function ftos.files.mergeAsPdf(reports: string[], reportName: string, deleteInitialReports: boolean, addPageBetweenReports: boolean): string
| Parameter | Description |
|---|---|
reports | Array of strings containing the unique internal IDs of the merged files (real names) in the order you wish to merge them. |
reportName | Name of the resulting merged file. |
deleteInitialReports |
|
addPageBetweenReports |
|
Return Value
Returns a string containing the saved merged file's real name.
Examples
In this example:
- We merge the january_03d894e2-eb06-4641-a1e6-c711dd046e1a.pdf, february_19f5e30d-cf3c-41af-9e6b-d5024f4bd77f.pdf, and march_9ad66daa-53ff-4707-870b-d347c5e323ea.pdf files into a document called trimester1.pdf.
- After the merge, we don't delete the monthly reports (false).
- In the merged file, we insert a blank page between the monthly reports (true).
- We save the resulting file ID in a variable called trimesterReport.
var trimesterReport = ftos.files.mergeAsPdf(['january_03d894e2-eb06-4641-a1e6-c711dd046e1a.pdf', 'february_19f5e30d-cf3c-41af-9e6b-d5024f4bd77f.pdf', 'march_9ad66daa-53ff-4707-870b-d347c5e323ea.pdf'], 'trimester1', false, true);