pdfme.encoders

pdfme.encoders.encode_stream(stream, filter, parameters=None)

Function to use filter method to encode stream, using parameters if required.

Parameters
  • stream (bytes) – the stream to be encoded.

  • filter (bytes) – the method to use for the encoding process.

  • parameters (dict, optional) – if necessary, this dict contains the parameters required by the filter method.

Raises
  • NotImplementedError – if the filter passed is not implemented yet.

  • Exception – if the filter passed doesn’t exist.

Returns

the encoded stream.

Return type

bytes

pdfme.encoders.flate_encode(stream)

Function that encodes a bytes stream using the zlib.compress method.

Parameters

stream (bytes) – stream to be encoded.

Returns

the encoded stream.

Return type

bytes