Design
File operations
Append, merge or attach files in the generated document
ENTERPRISE FEATURE
Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
v4.23.0+
Overview
Available operations:
- appendFile: Append PDF files at the end of the generated document.
- attachFile: Attach an external file inside a PDF (e.g., XML for Factur-X and ZUGFeRD).
Compatible with generated PDF files.
:appendFile
v4.22.0+
Append an external file inside the generated the document
Only PDF files can be added at the end of the current generated document.
If the generated file is not a PDF, the command is ignored.
Carbone will return an error and will not generate the report in the following scenarios:
- If the provided URL returns an error (2 retries for Carbone Cloud).
- If the downloaded document is not recognized as a valid PDF.
- If more than 20 files are to be downloaded (On-Premise parameter:
maxDownloadFileCount
) - If the total size of all downloaded files exceeds 50 MB (On-Premise parameter:
maxDownloadFileSizeTotal
).
Carbone will ignore the formatter and proceed to generate the report in the following cases: - If the provided URL is null, undefined, or an empty string.
- If the final report is not in PDF format
Example 1 : technical sheet
Data
{
"quoteId" : 4242,
"products": [
{
"name": "PV 500w Half-Cut",
"datasheet": "https://carbone.io/examples/append-file-1/dualsun-A3-technical-drawing-500w.pdf"
},
{
"name" : "PV 425w Half-Cut",
"datasheet" : "https://carbone.io/examples/append-file-1/dualsun-A4-technical-drawing-425w.pdf"
}
]
}
Template
In this example, {d.products[i].datasheet:appendFile}
is used to add the technical sheets for each product at the end of the generated PDF.
The appendFile
function preserves the original format (A4, A3, etc.) and the orientation (landscape, portrait) of the appended files.
Result
:attachFile(name, type)
v4.23.0+
Attach an external file inside the generated the document
File attachment is a special feature of PDFs. It can be used for example to add Factur-X XML information
If the generated file is not a PDF, the command is ignored.
Carbone will return an error and will not generate the report in the following scenarios:
- If the provided URL returns an error (2 retries for Carbone Cloud).
- If the downloaded document is not recognized as a valid PDF.
- If more than 20 files are to be downloaded (On-Premise parameter:
maxDownloadFileCount
) - If the total size of all downloaded files exceeds 50 MB (On-Premise parameter:
maxDownloadFileSizeTotal
).
Carbone will ignore the formatter and proceed to generate the report in the following cases: - If the provided URL is null, undefined, or an empty string.
- If the final report is not in PDF format
Params | Description | Type |
---|---|---|
name | file name | String |
type | attachment type AFRelationship. Can be "Source", "Data" (by default), "Alternative", "Supplement", "Unspecified", "FormData", "Schema". | String |
Example Factur-X and ZUGFeRD
An example is coming soon.