As you already know, since 4D v20 R3, 4D Write Pro can export in PDF/A2 and PDF/A3 (BLOG) formats. Apart from the signature, the main difference between these two formats is that the PDF/A3 format can include attachments. The good news is that thanks to a new export option in 4D Write Pro, it is possible, with 4D v20 R4, to have attachments when exporting!
Archiving to the power of 10
The PDF/A signature means and guarantees that a document of this type will be readable for decades, as explained in this BLOG.
The PDF/A3 format allows attachments of any type (Word, Excel, PDF, Photoshop, etc.) to be inserted inside the PDF/A3.
The advantage is that you can store all the information you need on a specific subject in a single document.
Whether your area of interest is legal, technical, medical, accounting, security, construction, public works, or any other, if you need to archive documents containing attachments, PDF/A3 is the format you need!
one or more attachments
The PDF/A3 standard allows you to insert as many attachments as possible. This is why the new export option, .files, is of the collection type.
Each element of this collection is an object with a few simple properties, some of which are optional.
The first and most apparent is the .file property of type 4D.File indicates the physical file to be included in the PDF. It can, however, be replaced by the .data property of text or BLOB type. These two properties are exclusive: if the .data property is present, the .file property will be ignored.
The .description property is optional, as is .mimeType, which can generally be deduced from the content of .file or .data.
Finally, .name is the file name that will be extracted from the PDF. This one is only mandatory if the .data property has been used and not the .file property. Otherwise, by default, it will have the same name as the original file defined in .file!
a simple code sample
The code below shows how to insert two physical files plus a simple text sent as data.
$options:={} // empty object
$options[wk files]:=[] // empty collection
// 1st file (based on .file)
$fileInfo:={}
$fileInfo.description:="RTF formated text"
$fileInfo.file:=File(Folder(fk data folder).path+"Alpha.rtf")
$options[wk files].push($fileInfo)
// 2nd file (based on .file)
$fileInfo:={}
$fileInfo.description:="Png picture"
$fileInfo.file:=File(Folder(fk data folder).path+"Bravo.png")
$options[wk files].push($fileInfo)
// 3rd file (based on .data)
$fileInfo:={}
$fileInfo.name:="Charlie.txt" // will be used for extraction
$fileInfo.description:="raw text sent as data"
$fileInfo.data:="This is some raw text to be included as enclosure in the PDF and to be extracted as 'Charlie.txt'"
$options[wk files].push($fileInfo)
WP EXPORT DOCUMENT($document; "exportWithEnclosures.pdf"; wk pdf; $options)
Note: when you use the wk files attribute, the version of the generated PDF will automatically be PDF/A3, and the wk pdfa version option, if present, will be ignored.
Once executed, the PDF document will look like this (using Adobe Acrobat Reader™)
Conclusion (and to be continued!)
Attaching documents within a single PDF/A3 file means you can take full advantage of what this standard allows. But that’s not all! As you will soon see, it will also enable electronic invoices to be generated by inserting an XML document as the first file in the attachments! Stay tuned!