ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Print functions
  • Format of the PDF file
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
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.
Android This function cannot be used for a programmed state (created with iXXX printing functions).
Example
// PDF destination
iDestination(iGenericPDF, "c:\path\pdf.pdf")

// Add an attachment
iAddAttachment("c:\path\pj.xls", "Example spreadsheet", "application/vnd.ms-excel")

// Positions a bookmark and a text at 5 cm from the top of the page
iYPos(50)
iAddBookmark("page 1 line 1", "First line of the first page", "page1")
iPrint("First line of the first page")

// End of print
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:
    mimeTypeXMLApplicationXML content.
    mimeTypeBinaryBinary content (byte stream).
    mimeTypeDOCWord file (*.doc)
    mimeTypeDOCXWord file (*.docx)
    mimeTypeGIFGIF image (*.gif)
    mimeTypeHTMLHTML page (*.htm, *.html)
    mimeTypeJPEGJPEG image (*.jpg, *.jpeg)
    mimeTypeJSONJSON content.
    mimeTypePDFPDF document (*.pdf)
    mimeTypePNGJPEG image (*.png)
    mimeTypeSOAPSOAP content in XML format.
    mimeTypeTextText (*.txt)
    mimeTypeXMLTextXML text
    mimeTypeXLSExcel file (*.xls)
    mimeTypeXLSXExcel file (*.xlsx)
    mimeTypeZIPZIP file (*.zip)
<Possible relationship>: Optional Integer constant
New in version 2025
Possible 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.
relationshipDataFile specification corresponding to information used to derive a visual presentation. Example: Table or graph.
relationshipSourceFile specification corresponding to the original source material for the associated content.
relationshipSupplementFile specification corresponding to an additional representation of the original source or data.
relationshipUnspecifiedThe relationship is unknown or cannot be described using one of the other constants.

Android Attention This setting is only available for Android applications from version 2025 Update 1.

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:
    mimeTypeXMLApplicationXML content.
    mimeTypeBinaryBinary content (byte stream).
    mimeTypeDOCWord file (*.doc)
    mimeTypeDOCXWord file (*.docx)
    mimeTypeGIFGIF image (*.gif)
    mimeTypeHTMLHTML page (*.htm, *.html)
    mimeTypeJPEGJPEG image (*.jpg, *.jpeg)
    mimeTypeJSONJSON content.
    mimeTypePDFPDF document (*.pdf)
    mimeTypePNGJPEG image (*.png)
    mimeTypeSOAPSOAP content in XML format.
    mimeTypeTextText (*.txt)
    mimeTypeXMLTextXML text
    mimeTypeXLSExcel file (*.xls)
    mimeTypeXLSXExcel file (*.xlsx)
    mimeTypeZIPZIP 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 2025
Possible 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.
relationshipDataFile specification corresponding to information used to derive a visual presentation. Example: Table or graph.
relationshipSourceFile specification corresponding to the original source material for the associated content.
relationshipSupplementFile specification corresponding to an additional representation of the original source or data.
relationshipUnspecifiedThe relationship is unknown or cannot be described using one of the other constants.

Android Attention This setting is only available for Android applications from version 2025 Update 1.
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
Component: wd300prn.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/07/2025

Send a report | Local help