pdf_writer::writers

Struct DecodeParms

source
pub struct DecodeParms<'a> { /* private fields */ }
Expand description

Writer for an filter decode parameters dictionary.

This struct is created by Stream::decode_parms.

Implementations§

source§

impl DecodeParms<'_>

Properties for FlateDecode and LzwDecode.

source

pub fn predictor(&mut self, predictor: Predictor) -> &mut Self

Write the /Predictor attribute for FlateDecode and LzwDecode.

No predictor is used by default.

source

pub fn colors(&mut self, colors: i32) -> &mut Self

Write the /Colors attribute for FlateDecode and LzwDecode.

Must be greater than 0. /Predictor must be set. Defaults to 1.

source

pub fn bits_per_component(&mut self, bits: i32) -> &mut Self

Write the /BitsPerComponent attribute for FlateDecode and LzwDecode.

Must be one of 1, 2, 4, 8, or 16. /Predictor must be set. Defaults to 8.

source

pub fn columns(&mut self, columns: i32) -> &mut Self

Write the /Columns attribute for FlateDecode and LzwDecode or CcittFaxDecode.

When used with FlateDecode and LzwDecode, it indicates the number of samples in each row. In that case, /Predictor must be set and the default is 1.

When used with CcittFaxDecode it denominates the width of the image in pixels and defaults to 1728.

source

pub fn early_change(&mut self, early_change: bool) -> &mut Self

Write the /EarlyChange attribute for LzwDecode.

If true (1), the code length increases one code earlier, if false (0), length change is postponed as long as possible.

Defaults to 1.

source§

impl DecodeParms<'_>

Properties for CcittFaxDecode. Also see Self::columns.

source

pub fn k(&mut self, k: i32) -> &mut Self

Write the /K attribute for CcittFaxDecode.

Defaults to 0.

source

pub fn end_of_line(&mut self, eol: bool) -> &mut Self

Write the /EndOfLine attribute for CcittFaxDecode.

Whether the EOL bit pattern is present in the encoding. Defaults to false.

source

pub fn encoded_byte_align(&mut self, encoded_byte_align: bool) -> &mut Self

Write the /EncodedByteAlign attribute for CcittFaxDecode.

Whether to expect zero bits before each encoded line. Defaults to false.

source

pub fn rows(&mut self, rows: i32) -> &mut Self

Write the /Rows attribute for CcittFaxDecode.

The image’s height. Defaults to 0.

source

pub fn end_of_block(&mut self, end_of_block: bool) -> &mut Self

Write the /EndOfBlock attribute for CcittFaxDecode.

Whether to expect an EOB code at the end of the data. Defaults to true.

source

pub fn black_is_1(&mut self, black_is_1: bool) -> &mut Self

Write the /BlackIs1 attribute for CcittFaxDecode.

Whether to invert the bits in the image. Defaults to false.

source

pub fn damaged_rows_before_error(&mut self, count: i32) -> &mut Self

Write the /DamagedRowsBeforeError attribute for CcittFaxDecode.

How many damaged rows are allowed before an error is raised. Defaults to 0.

source§

impl DecodeParms<'_>

Properties for Jbig2Decode.

source

pub fn jbig2_globals(&mut self, globals: Ref) -> &mut Self

Write the /JBIG2Globals attribute for Jbig2Decode.

A reference to a stream containing global segments.

source§

impl DecodeParms<'_>

Properties for JpxDecode.

source

pub fn color_transform(&mut self, color_transform: bool) -> &mut Self

Write the /ColorTransform attribute for JpxDecode.

How to handle color data. If true (1), images with three color channels shall be decoded from the YCbCr space and images with four color channels are decoded from YCbCrK. If false (0), no transformation is applied. The default depends on the APP14 marker in the data stream.

source§

impl DecodeParms<'_>

Properties for Crypt.

source

pub fn crypt_type(&mut self) -> &mut Self

Write the /Type attribute for Crypt as CryptFilterDecodeParms.

source

pub fn name(&mut self, name: Name<'_>) -> &mut Self

Write the /Name attribute for Crypt.

The name of the crypt filter corresponding to a CF entry of the encryption dictionary.

Methods from Deref<Target = Dict<'a>>§

source

pub fn len(&self) -> i32

The number of written pairs.

source

pub fn is_empty(&self) -> bool

Whether no pairs have been written so far.

source

pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>

Start writing a pair with an arbitrary value.

source

pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self

Write a pair with a primitive value.

This is a shorthand for dict.insert(key).primitive(value).

source

pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)>, ) -> &mut Self

Write a sequence of pairs with primitive values.

Trait Implementations§

source§

impl<'a> Deref for DecodeParms<'a>

source§

type Target = Dict<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for DecodeParms<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, 'any> Rewrite<'a> for DecodeParms<'any>

source§

type Output = DecodeParms<'a>

The writer with the rewritten lifetime.
source§

impl<'a> Writer<'a> for DecodeParms<'a>

source§

fn start(obj: Obj<'a>) -> Self

Start writing the object.

Auto Trait Implementations§

§

impl<'a> Freeze for DecodeParms<'a>

§

impl<'a> RefUnwindSafe for DecodeParms<'a>

§

impl<'a> Send for DecodeParms<'a>

§

impl<'a> Sync for DecodeParms<'a>

§

impl<'a> Unpin for DecodeParms<'a>

§

impl<'a> !UnwindSafe for DecodeParms<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Finish for T

source§

fn finish(self)

Does nothing but move self, equivalent to drop.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.