Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 141

Previous Page 140   Index   Next Page 142

Function Reference
Page 141 of 750
AttachFile
Syntax:
SI32 pdfAttachFile(
const PPDF* IPDF,
// Instance pointer
const char* FilePath,
// File that should be attached
const char* Description, // Optional description
LBOOL Compress)
// If true, the file will be compressed
The function attaches a file to the document. The description is optional, the parameter can be set to
NULL. The embedded file is compressed if the parameter Compress is set to true. Otherwise it is left
uncompressed. It is not always useful to compress embedded files especially if the file is already
compressed, e.g. Zip files or already compressed image formats require no further compression. In
the worst case the compressed file becomes larger as the uncompressed version. However, text files
and most document formats should be compressed to reduce the file size.
Remarks:
This function is implemented in an Ansi and Unicode compatible version. Unicode paths are
converted to UTF-8 on non-Windows operating systems.
Please note that embedded files must be associated with a PDF object in PDF/A 3 files. See
AssociateEmbFile() for further information.
Return values:
If the function succeeds the return value is the handle of the embedded file, a value greater or equal
zero. If the function fails the return value is a negative error code.
AttachFileEx
Syntax:
SI32 pdfAttachFileEx(
const PPDF* IPDF,
// Instance pointer
const void* Buffer,
// File buffer
UI32 BufSize,
// Buffer size
const char* FileName,
// File name to display in a viewer
const char* Description, // Optional description
LBOOL Compress)
// If true, the file will be compressed
The function attaches a file to the document in the same way as AttachFile() but accepts a file buffer
instead of a file path. The description is optional, the parameter can be set to NULL. The embedded
file is compressed if the parameter Compress is set to true. Otherwise it is left uncompressed. It is not
always useful to compress embedded files especially if the file is already compressed, e.g. Zip files or
already compressed image formats require no further compression. In the worst case the compressed
files becomes larger as the uncompressed version. However, text files and most document formats
should be compressed to reduce the file size.
 

Previous topic: AssociateEmbFile

Next topic: AttachImageBuffer (Rendering Engine)