# Attachments

# Introduction

It can sometimes be useful to include "external" attachments when sending documents. Common examples include:

  • a visual representation of the main document, e.g. a PDF
  • an image of scanned receipts or other objects that acts a base for the document
  • detailed time sheets
  • an image of a product

Below, we describe the various technical solutions that exist to provide this functionality.


# Supported file types

The following attachment file types are supported by us:

File type Extension MIME type
PDF .pdf application/pdf
JPEG .jpg,
.jpeg
image/jpeg
TIFF .tif,
.tiff
image/tiff
GIF .gif image/gif
BMP .bmp image/x-bitmap
SVG .svg image/svg+xm
PostScript .ps application/postscript
MS Excel .xls,
.xlsx
application/vnd.ms-excel,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
MS Word .doc,
.docx
application/msword,
application/vnd.openxmlformats-officedocument.wordprocessingml.document
MS Powerpoint .ppt,
.pptx
application/ppt,
application/vnd.openxmlformats-officedocument.presentationml.presentation
Plain text .txt text/plain
RTF .rtf application/rtf
CSV .csv text/csv
EML .eml multipart/signed
XML .xml application/xml, text/xml
HTML .html text/html
ZIP .zip application/zip
P7M .p7m application/pkcs7-mime
P7B .p7b application/pkcs7-mime
P7S .p7s application/x-pkcs7-signature
PK7 .pk7 application/x-pk7

Please note that it also depends on the receiver, their system capabilities and in some cases; the receiver's service provider as well.


# Attachment file size

The industry recommendation is 5 MB for each attached file.


# Multiple attachments

There is no limit in regards to how many attachments you can send; send as many as you'd like!


# Presentation images

Providing an presentation/image of the electronic document is sometimes useful.

We support this where applicable, but please be aware that it might not always get forwarded to the receiver due to limitations in the target format or in the interoperability agreement between us and the receiver's service provider.


# Embedded

In a lot of modern formats, it is possible to include attachments within the actual main document. The only requirement is that they are Base64-encoded as binary objects.

This is the most elegant and failsafe way of including attachments.

More information on Base64 can be found here and here.

# Examples

Peppol BIS Billing 3.0 example
<?xml version="1.0" encoding="UTF-8"?>
<Invoice ...>
    <!-- Omitted for clarity -->
    <cbc:ID>123456789</cbc:ID>
    <!-- Omitted for clarity -->
    <cac:AdditionalDocumentReference>
        <cbc:ID>987654321</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject 
              filename="scanned_receipts.pdf" 
              mimeCode="application/pdf"
                >JVBERi0xLjMNCiXi48/TDQolUlNUWFBERjMgUGFyY
                ... 
                gMCBSDQo+Pg0Kc3RhcnR4cmVmDQoyNDIzMQ0KJTg==</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <!-- Omitted for clarity -->
</Invoice>
IFS e-invoice 2.0 example
<?xml version="1.0" encoding="UTF-8"?>
<IFSFinvoice Version="2.0"...>
    <!-- Omitted for clarity -->
    <InvoiceDetails>
        <!-- Omitted for clarity -->
        <InvoiceNumber>123456789</InvoiceNumber>
    </InvoiceDetails>
    <InvoiceAttachments>
        <FileName>invoice_image.pdf</FileName>
        <DocumentType>ATS</DocumentType>
        <Attachment>JVBERi0xLjMKJaqrrK0KNCAwIG9iago8PCAvVHlwZSAvSW5mbwovUHJv
          MDAwIG4gCjAwMDAwNjcyOTMgMDAwMDAgbiAKMDAwMDA2NzQ0MCAwMDAwMCBuIAowMDAwMDY3OTM0
          ...
          IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgMjgKL1Jvb3QgMiAwIFIKL0luZm8gNCAwIFIKPj4K
          c3RhcnR4cmVmCjY5NTUwCiUlRU9GCg==
        </Attachment>
        <MimeType>pdf</MimeType>
        <Description>invoice_image_123</Description>
    </InvoiceAttachments>
</IFSFinvoice>

# Batched attachments

Another way of sending attachments is by putting them aside the main document within a structure allowing for main document and attachment to be provided within the same file. One of the most common ways of doing this is by using a compressed folder. The .zip-archive is highly adopted and used.

The structure within the .zip-file should include the main document together with the corresponding attachments.

# Example

Example directory structure within ZIP
invoice123.zip
\-- invoice123.xml
\-- invoice123_presentation.pdf
\-- invoice123_misc.xsls

It is important that the structure is/remains the same for every document sent.


# Matched via filename

Attachments can also be matched to their main document via filename syntax.

This works in e.g. FTP/SFTP setups, but not necessarily in HTTPS, AS2 etc. Please see each communication protocol section in order to understand what attachment handling is available for your selected protocol.

# To Pagero

When sending files to Pagero; we are able to work with any filenaming syntax you´d like. The important part is that the structure stays the same for every document and that the filenames unique so as to avoid duplicate clashes on the filesystem.

# Example

Example filename structure
invoice123.xml
invoice123_presentation.pdf
invoice123_misc.xsls

# From Pagero

When receiving files from Pagero; we can set up the filenaming convention to suit you and your system requirements.

Please keep in mind that we need to include at least one parameter that is unique in the filenames, in order to avoid the chance of getting write errors due to duplicates on receiving server.