PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
New WINDEV, WEBDEV, WINDEV Mobile 24 feature!
  • Format of the PDF file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 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 (with quotes)
Full or relative path of the file on disk to be added after the PDF file print generation.
<Description>: Optional character string (with quotes)
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:
    Versions 22 and later
    typeMimeXMLApplication
    New in version 22
    typeMimeXMLApplication
    typeMimeXMLApplication
    XML content.
    Versions 22 and later
    typeMimeBinary
    New in version 22
    typeMimeBinary
    typeMimeBinary
    Binary content (byte stream).
    Versions 22 and later
    typeMimeDOC
    New in version 22
    typeMimeDOC
    typeMimeDOC
    Content such as Word file (*.doc)
    Versions 22 and later
    typeMimeDOCX
    New in version 22
    typeMimeDOCX
    typeMimeDOCX
    Content such as Word file (*.docx)
    Versions 22 and later
    typeMimeGIF
    New in version 22
    typeMimeGIF
    typeMimeGIF
    Content such as Image in GIF format (*.gif)
    Versions 22 and later
    typeMimeHTML
    New in version 22
    typeMimeHTML
    typeMimeHTML
    Content such as HTML page (*.htm, *.html)
    Versions 22 and later
    typeMimeJPEG
    New in version 22
    typeMimeJPEG
    typeMimeJPEG
    Content such as image in JPEG format (*.jpg, *.jpeg)
    Versions 22 and later
    typeMimeJSON
    New in version 22
    typeMimeJSON
    typeMimeJSON
    JSON content.
    Versions 22 and later
    typeMimePDF
    New in version 22
    typeMimePDF
    typeMimePDF
    Content such as PDF document (*.pdf)
    Versions 22 and later
    typeMimePNG
    New in version 22
    typeMimePNG
    typeMimePNG
    Content such as image in JPEG format (*.png)
    Versions 22 and later
    typeMimeSOAP
    New in version 22
    typeMimeSOAP
    typeMimeSOAP
    SOAP content in XML format.
    Versions 22 and later
    typeMimeText
    New in version 22
    typeMimeText
    typeMimeText
    Content in text format (*.txt)
    Versions 22 and later
    typeMimeXMLText
    New in version 22
    typeMimeXMLText
    typeMimeXMLText
    Text content in XML format
    Versions 22 and later
    typeMimeXLS
    New in version 22
    typeMimeXLS
    typeMimeXLS
    Content in Excel format (*.xls)
    Versions 22 and later
    typeMimeXLSX
    New in version 22
    typeMimeXLSX
    typeMimeXLSX
    Content in Excel format (*.xlsx)
    Versions 22 and later
    typeMimeZIP
    New in version 22
    typeMimeZIP
    typeMimeZIP
    Content 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 (with quotes)
Name of the attachment that will be displayed in the PDF file.
<Description>: Optional character string (with quotes)
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:
    Versions 22 and later
    typeMimeXMLApplication
    New in version 22
    typeMimeXMLApplication
    typeMimeXMLApplication
    XML content.
    Versions 22 and later
    typeMimeBinary
    New in version 22
    typeMimeBinary
    typeMimeBinary
    Binary content (byte stream).
    Versions 22 and later
    typeMimeDOC
    New in version 22
    typeMimeDOC
    typeMimeDOC
    Content such as Word file (*.doc)
    Versions 22 and later
    typeMimeDOCX
    New in version 22
    typeMimeDOCX
    typeMimeDOCX
    Content such as Word file (*.docx)
    Versions 22 and later
    typeMimeGIF
    New in version 22
    typeMimeGIF
    typeMimeGIF
    Content such as Image in GIF format (*.gif)
    Versions 22 and later
    typeMimeHTML
    New in version 22
    typeMimeHTML
    typeMimeHTML
    Content such as HTML page (*.htm, *.html)
    Versions 22 and later
    typeMimeJPEG
    New in version 22
    typeMimeJPEG
    typeMimeJPEG
    Content such as image in JPEG format (*.jpg, *.jpeg)
    Versions 22 and later
    typeMimeJSON
    New in version 22
    typeMimeJSON
    typeMimeJSON
    JSON content.
    Versions 22 and later
    typeMimePDF
    New in version 22
    typeMimePDF
    typeMimePDF
    Content such as PDF document (*.pdf)
    Versions 22 and later
    typeMimePNG
    New in version 22
    typeMimePNG
    typeMimePNG
    Content such as image in JPEG format (*.png)
    Versions 22 and later
    typeMimeSOAP
    New in version 22
    typeMimeSOAP
    typeMimeSOAP
    SOAP content in XML format.
    Versions 22 and later
    typeMimeText
    New in version 22
    typeMimeText
    typeMimeText
    Content in text format (*.txt)
    Versions 22 and later
    typeMimeXMLText
    New in version 22
    typeMimeXMLText
    typeMimeXMLText
    Text content in XML format
    Versions 22 and later
    typeMimeXLS
    New in version 22
    typeMimeXLS
    typeMimeXLS
    Content in Excel format (*.xls)
    Versions 22 and later
    typeMimeXLSX
    New in version 22
    typeMimeXLSX
    typeMimeXLSX
    Content in Excel format (*.xlsx)
    Versions 22 and later
    typeMimeZIP
    New in version 22
    typeMimeZIP
    typeMimeZIP
    Content 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 you to add files to PDF files in standard PDF and PDF/A-3b format.
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.
Component : wd240prn.dll
Minimum required version
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment