Creates a new Cos stream, using data from an existing. The data is copied, so the source stream may be closed after CosNewStream returns. This method creates a Cos stream object by writing its PDF representation to an intermediate file in this format: See the description of the Stream Objects in "Objects," in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.3.8, page 19. You can find this document on the web store of the International Standards Organization (ISO). This occurs in four steps: Ifis a valid Cos dictionary, the method writes that dictionary to the intermediate file. Otherwise, it creates a new direct dictionary, determining akey according to thevalue: Ifis negative, or if the source data is to be encoded (see below), the value of thekey is a reference to a new indirect object, whose value will be set in. Otherwise,is a direct scalar representing. The dictionary that is written becomes the new stream's attribute dictionary. determines where in the source stream to begin reading, and whether the source is seekable. Ifis a negative number, the source is assumed to be non-seekable but positioned at the point where reading should start. Otherwise, the source is assumed to be seekable, and reading starts at the position indicated by. Ifis zero, data is read from the beginning of the source stream. Positive values formay be used, for instance, to skip over initial data in the stream. Ifis a valid Cos dictionary, it contains akey, andis, the method encodes the data after reading it from the source stream and before writing it to the intermediate file. Theis used as the new stream's dictionary. Theentry in this dictionary indicates how the data in the resulting Cos stream object will be subsequently decoded; the value may be the name of a decoding filter or an array of such names. Specify multiple filters in the order they should be applied to decode the data (if parameters are needed to decode the data, they are specified as the value of thekey in. See the description of the DecodeParms attribute in Table 5 in ISO 32000-1:2008, Document Management-Portable Document Format- Part 1: PDF 1.7, section 7.3.8.2, page 20. You can find this document on the web store of the International Standards Organization (ISO). For each decoding filter, there is a corresponding encoding filter, which the method applies to the source data during this step. If parameters are needed to encode the data, they must be specified in the call by(the encoding parameters are often different from the decoding parameters). Theparameter is optional for all encoding filters exceptand. See thefield of. If an array of filters is supplied, and at least one of them requires encoding parameters, then a corresponding array of encoding parameters is also required. Use theobject to represent default parameters for filters that have defaults. In any other case, the method copies the source data directly into the Cos stream with no encoding. Ifis negative, it reads bytes until the source reaches its EOF. Otherwise,indicates how many bytes to read from the source, and an exception is raised if the source reaches EOF before that. After the data is written, if the value of thekey in the attributes dictionary was an indirect reference (either because it was supplied that way in, or because it was created that way in, the value of that indirect object is set to the number of bytes actually written (that is, the encoded length if the data was encoded). An indirectkey is useful for one-pass writing, when the size of the written data is not known in advance, either because the data was to be encoded, or because there was no way to know how much data there would be before the source reached its EOF. An exception is raised ifis neither theobject nor a direct Cos dictionary,is nonnegative but the source is not seekable, or ifis nonnegative but the source stream reaches EOF before that many bytes have been read. For attributeDict, see the description of Stream Objects in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.9, page 288. You can find this document on the web store of the International Standards Organization (ISO). See the encoding step in the description above. You can find this document on the web store of the International Standards Organization (ISO). See the encoding step in the description above. If no encoding parameters are needed, this value is ignored. CosNewStream() sets the documentflag (see PDDocFlags). You cannot callon a stream created withuntil the file has been saved.