Manipulate content of a Document Pack

The content of the Document Pack is based on slots in the Document Pack Templates and channels which define exceptions for content within a slot. Each of the documents in the slots and channels can have additional alternative representations in different formats.

It is not possible to introduce new slots or channels into a Document Pack. The only operations allowed are the introduction of new alternative formats and manipulation of existing files.

To locate a file in the Document Pack, use the get_document_from_pack function (see get_document_from_pack (s, c, t, d)). This function returns the fully qualified name to the specific document in the pack. The contents of this document can be changed or used for further processing.

The command IterateDocumentPack allows the script to walk through the contents of the Document Pack, and call a processing script for each document that matches the filter conditions. See IterateDocumentPack.

The command InsertDocumentPack allows the script to insert new alternative representations into the Document Pack or to point an alternative representation to a new file. See InsertDocumentPack.

The following example enumerates all templates in a Document Pack and adds a PDF conversion of each result document to the Document Pack.

IterateDocumentPack
	    Script (AddPDFAlternative)
					Context (“custom context-sensitive information”)
					Status (“T”);

The script AddPDFAlternative.dss performs the actual conversion.

Parameter Text Document;
Parameter Text Slot;
Parameter Text Channel;

If get_document_from_pack (Slot, Channel, “pdf”, False) = “” Then
					DocToPDF
										Src (Document)
										Dest (Document [ , “pdf” ]);
					InsertDocumentPack
										Document (Document [ , “pdf” ])
										Type (“pdf”)
										Slot (Slot)
										Channel (Channel);
Fi;