PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • 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:
    typeMimeXMLApplicationXML content.
    typeMimeBinaryBinary content (byte stream).
    typeMimeDOCContent such as Word file (*.doc)
    typeMimeDOCXContent such as Word file (*.docx)
    typeMimeGIFContent such as Image in GIF format (*.gif)
    typeMimeHTMLContent such as HTML page (*.htm, *.html)
    typeMimeJPEGContent such as image in JPEG format (*.jpg, *.jpeg)
    typeMimeJSONJSON content.
    typeMimePDFContent such as PDF document (*.pdf)
    typeMimePNGContent such as image in JPEG format (*.png)
    typeMimeSOAPSOAP content in XML format.
    typeMimeTextContent in text format (*.txt)
    typeMimeXMLTextText content in XML format
    typeMimeXLSContent in Excel format (*.xls)
    typeMimeXLSXContent in Excel format (*.xlsx)
    typeMimeZIPContent in ZIP format (*.zip)

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

iAddAttachment(<Buffer to add> , <Attachment name> [, <Description> [, <MIME type> [, <Creation date> [, <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:
    typeMimeXMLApplicationXML content.
    typeMimeBinaryBinary content (byte stream).
    typeMimeDOCContent such as Word file (*.doc)
    typeMimeDOCXContent such as Word file (*.docx)
    typeMimeGIFContent such as Image in GIF format (*.gif)
    typeMimeHTMLContent such as HTML page (*.htm, *.html)
    typeMimeJPEGContent such as image in JPEG format (*.jpg, *.jpeg)
    typeMimeJSONJSON content.
    typeMimePDFContent such as PDF document (*.pdf)
    typeMimePNGContent such as image in JPEG format (*.png)
    typeMimeSOAPSOAP content in XML format.
    typeMimeTextContent in text format (*.txt)
    typeMimeXMLTextText content in XML format
    typeMimeXLSContent in Excel format (*.xls)
    typeMimeXLSXContent in Excel format (*.xlsx)
    typeMimeZIPContent in ZIP format (*.zip)
<Creation date>: 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: wd270prn.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment