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:

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:

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.

AppendFile template

Download the DOCX template.

Result

AppendFile result

Download the PDF 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:

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.