Name
  doc:SetCompressionMode -- set document compression mode
Synopsis

      status = doc:SetCompressionMode(mode)

Function
  `doc:SetCompressionMode()` sets the mode of compression. `mode` can be a combination of the following flags:

  `#HPDF_COMP_NONE:`
    No compression. This cannot be combined with any other flags.

  `#HPDF_COMP_TEXT:`
    Compress the contents stream of the page.

  `#HPDF_COMP_IMAGE:`
    Compress the streams of the image objects.

  `#HPDF_COMP_METADATA:`
    Other stream datas (fonts, cmaps and so on) are compressed.

  `#HPDF_COMP_ALL:`
    All stream data is compressed. This is the same as setting `#HPDF_COMP_TEXT`, `#HPDF_COMP_IMAGE`, and `#HPDF_COMP_METADATA` together.

  When `doc:SetCompressionMode()` succeeds, it returns `#HPDF_OK`. Otherwise, it returns an error code and the error handler is called.

Inputs
  mode
    a combination of the flags listed above
Results
  status
    status code
Errors
  `#HPDF_INVALID_DOCUMENT` - An invalid document handle was set.

  `#HPDF_INVALID_COMPRESSION_MODE` - An invalid compression mode was specified.

  `#HPDF_FAILED_TO_ALLOC_MEM` - Memory allocation failed.

Show TOC