ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Print functions
  • Format of the PDF file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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.
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>]])
<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 most browsers are:
    • "application/pdf": document in PDF format (*.pdf)
    • "text/html": HTML page (*.htm, *.html)
    • "text/plain": text file (*.txt)
    • "image/gif": image in GIF format (*.gif)
    • "image/jpeg": image in JPEG format (*.jpg, *.jpeg)
    • "video/mpeg": video in MPEG format (*.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)

Adding an attachment (as a buffer) to a PDF file Hide the details

iAddAttachment(<Buffer to add> , <Attachment name> [, <Description> [, <MIME type> [, <Date created> [, <Modification date>]]]])
<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.
Caution: the extension of the attachment must be specified.
<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 most browsers are:
    • "application/pdf": document in PDF format (*.pdf)
    • "text/html": HTML page (*.htm, *.html)
    • "text/plain": text file (*.txt)
    • "image/gif": image in GIF format (*.gif)
    • "image/jpeg": image in JPEG format (*.jpg, *.jpeg)
    • "video/mpeg": video in MPEG format (*.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.
<Modification date>: Optional DateTime
Attachment UTC modification date.
Remarks

Format of the PDF file

iAddAttachment only allows adding files to PDF and PDF/A-3b files.
Reminder: The format in which the PDF will be generated can be chosen via iParameterPDF.
Caution: The PDF/A-1b format does not allow adding attachments: iAddAttachment generates a fatal error in that 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: 06/05/2024

Send a report | Local help