|
|
|
|
|
iAddAttachment (Function) In french: iAjoutePièceJointe Adds an attachment in a PDF file generated by a PDF print export. It must be exported: - with iDestination (iPDF or iGenericPDF constant).
- from the report viewer (also called "print preview").
- from the print mini-preview.
iDestination(iGenericPDF, "c:\path\pdf.pdf")
iAddAttachment("c:\path\pj.xls", "Example spreadsheet", "application/vnd.ms-excel")
iYPos(50)
iAddBookmark("page 1 line 1", "First line of the first page", "page1")
iPrint("First line of the first page")
iEndPrinting()
Syntax
Adding an attachment (as a file) to a PDF file Hide the details
iAddAttachment(<File to add> [, <Description> [, <MIME type> [, <Possible relationship>]]])
<File to add>: Character string Full or relative path of the file on disk to be added after the PDF file print generation. <Description>: Optional character string Short description of the file to add. <MIME type>: Optional character string or string constant Mime type associated to the added file: - Name of MIME type to use. More than 150 types are defined in the MIME communication standard (available on Internet). The most common values recognized by the majority of browsers are:
- "application/pdf": PDF file (*.pdf)
- "text/html": HTML page (*.htm, *.html)
- "text/plain": text file (*.txt)
- "image/gif": GIF image (*.gif)
- "image/jpeg": JPEG image (*.jpg, *.jpeg)
- "video/mpeg": MPEG video (*.mpg, *.mpeg)
- MIME type corresponding to one of the following constants:
| | mimeTypeXMLApplication | XML content. | mimeTypeBinary | Binary content (byte stream). | mimeTypeDOC | Word file (*.doc) | mimeTypeDOCX | Word file (*.docx) | mimeTypeGIF | GIF image (*.gif) | mimeTypeHTML | HTML page (*.htm, *.html) | mimeTypeJPEG | JPEG image (*.jpg, *.jpeg) | mimeTypeJSON | JSON content. | mimeTypePDF | PDF document (*.pdf) | mimeTypePNG | JPEG image (*.png) | mimeTypeSOAP | SOAP content in XML format. | mimeTypeText | Text (*.txt) | mimeTypeXMLText | XML text | mimeTypeXLS | Excel file (*.xls) | mimeTypeXLSX | Excel file (*.xlsx) | mimeTypeZIP | ZIP file (*.zip) |
<Possible relationship>: Optional Integer constant New in version 2025Possible relationship corresponding to the value of "AFRelationship" (required to use Factur-X): | | relationshipAlternative (Default value) | File specification corresponding to an alternative content representation. Example: Audio file. | relationshipData | File specification corresponding to information used to derive a visual presentation. Example: Table or graph. | relationshipSource | File specification corresponding to the original source material for the associated content. | relationshipSupplement | File specification corresponding to an additional representation of the original source or data. | relationshipUnspecified | The relationship is unknown or cannot be described using one of the other constants. |
Adding an attachment (as a buffer) to a PDF file Hide the details
iAddAttachment(<Buffer to add> , <Attachment name> [, <Description> [, <MIME type> [, <Date created> [, <Date modified> [, <Possible relationship>]]]]])
<Buffer to add>: Buffer Content to be added after the PDF file print generation. <Attachment name>: Character string Name of the attachment that will be displayed in the PDF file. Note: You must specify the extension of the attachment. <Description>: Optional character string Short description of the content to add. <MIME type>: Optional character string or string constant Mime type associated with the added content: - Name of MIME type to use. More than 150 types are defined in the MIME communication standard (available on Internet). The most common values recognized by the majority of browsers are:
- "application/pdf": PDF file (*.pdf)
- "text/html": HTML page (*.htm, *.html)
- "text/plain": text file (*.txt)
- "image/gif": GIF image (*.gif)
- "image/jpeg": JPEG image (*.jpg, *.jpeg)
- "video/mpeg": MPEG video (*.mpg, *.mpeg)
- MIME type corresponding to one of the following constants:
| | mimeTypeXMLApplication | XML content. | mimeTypeBinary | Binary content (byte stream). | mimeTypeDOC | Word file (*.doc) | mimeTypeDOCX | Word file (*.docx) | mimeTypeGIF | GIF image (*.gif) | mimeTypeHTML | HTML page (*.htm, *.html) | mimeTypeJPEG | JPEG image (*.jpg, *.jpeg) | mimeTypeJSON | JSON content. | mimeTypePDF | PDF document (*.pdf) | mimeTypePNG | JPEG image (*.png) | mimeTypeSOAP | SOAP content in XML format. | mimeTypeText | Text (*.txt) | mimeTypeXMLText | XML text | mimeTypeXLS | Excel file (*.xls) | mimeTypeXLSX | Excel file (*.xlsx) | mimeTypeZIP | ZIP file (*.zip) |
<Date created>: Optional DateTime Attachment UTC creation date. <Date modified>: Optional DateTime Attachment UTC modification date. <Possible relationship>: Optional Integer constant New in version 2025Possible relationship corresponding to the value of "AFRelationship" (required to use Factur-X): | | relationshipAlternative (Default value) | File specification corresponding to an alternative content representation. Example: Audio file. | relationshipData | File specification corresponding to information used to derive a visual presentation. Example: Table or graph. | relationshipSource | File specification corresponding to the original source material for the associated content. | relationshipSupplement | File specification corresponding to an additional representation of the original source or data. | relationshipUnspecified | The relationship is unknown or cannot be described using one of the other constants. |
Remarks Format of the PDF file iAddAttachment only allows adding files to PDF and PDF/A-3b files. Reminder: You can set the PDF file generation format with iParameterPDF. Caution: PDF/A-1b does not allow you to add attachments. iAddAttachment generates a fatal error in this case. Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|