Skip to main content
Skip table of contents

MemoryLimitsAwareHandler

MemoryLimitsAwareHandler Public class

Description

A MemoryLimitsAwareHandler handles memory allocation and prevents decompressed pdf streams from occupation of more space than allowed.

Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.MemoryLimitsAwareHandler[[MemoryLimitsAwareHandler]] end



Methods

Public methods

Returns

Name

long

GetMaxSizeOfDecompressedPdfStreamsSum()
Gets the maximum allowed size which can be occupied by all decompressed pdf streams.

int

GetMaxSizeOfSingleDecompressedPdfStream()
Gets the maximum allowed size which can be occupied by a single decompressed pdf stream.

MemoryLimitsAwareHandler

SetMaxSizeOfDecompressedPdfStreamsSum(long maxSizeOfDecompressedPdfStreamsSum)
Sets the maximum allowed size which can be occupied by all decompressed pdf streams.

MemoryLimitsAwareHandler

SetMaxSizeOfSingleDecompressedPdfStream(int maxSizeOfSingleDecompressedPdfStream)
Sets the maximum allowed size which can be occupied by a single decompressed pdf stream.

Internal methods

Returns

Name

MemoryLimitsAwareHandler

BeginDecompressedPdfStreamProcessing()
Begins handling of current pdf stream decompression.

MemoryLimitsAwareHandler

ConsiderBytesOccupiedByDecompressedPdfStream(long numOfOccupiedBytes)
Considers the number of bytes which are occupied by the decompressed pdf stream.

MemoryLimitsAwareHandler

EndDecompressedPdfStreamProcessing()
Ends handling of current pdf stream decompression.

long

GetAllMemoryUsedForDecompression()

Details

Summary

A MemoryLimitsAwareHandler handles memory allocation and prevents decompressed pdf streams from occupation of more space than allowed.

Constructors

MemoryLimitsAwareHandler [1/2]

Source code

public MemoryLimitsAwareHandler()

Summary

Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams. The max allowed memory limits will be generated by default.

MemoryLimitsAwareHandler [2/2]

Source code

public MemoryLimitsAwareHandler(long documentSize)

Arguments

Type

Name

Description

long

documentSize

the size of the document, which is going to be handled by iText.

Summary

Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams. The max allowed memory limits will be generated by default, based on the size of the document.

Methods

GetMaxSizeOfSingleDecompressedPdfStream

Source code

public int GetMaxSizeOfSingleDecompressedPdfStream()

Summary

Gets the maximum allowed size which can be occupied by a single decompressed pdf stream.

Returns

the maximum allowed size which can be occupied by a single decompressed pdf stream.

SetMaxSizeOfSingleDecompressedPdfStream

Source code

public MemoryLimitsAwareHandler SetMaxSizeOfSingleDecompressedPdfStream(int maxSizeOfSingleDecompressedPdfStream)

Arguments

Type

Name

Description

int

maxSizeOfSingleDecompressedPdfStream

the maximum allowed size which can be occupied by a single decompressed pdf stream.

Summary

Sets the maximum allowed size which can be occupied by a single decompressed pdf stream.

Remarks

Sets the maximum allowed size which can be occupied by a single decompressed pdf stream. This value correlates with maximum heap size. This value should not exceed limit of the heap size. iText will throw an exception if during decompression a pdf stream with two or more filters of identical type occupies more memory than allowed.

Returns

this MemoryLimitsAwareHandler instance.

GetMaxSizeOfDecompressedPdfStreamsSum

Source code

public long GetMaxSizeOfDecompressedPdfStreamsSum()

Summary

Gets the maximum allowed size which can be occupied by all decompressed pdf streams.

Returns

the maximum allowed size value which streams may occupy

SetMaxSizeOfDecompressedPdfStreamsSum

Source code

public MemoryLimitsAwareHandler SetMaxSizeOfDecompressedPdfStreamsSum(long maxSizeOfDecompressedPdfStreamsSum)

Arguments

Type

Name

Description

long

maxSizeOfDecompressedPdfStreamsSum

he maximum allowed size which can be occupied by all decompressed pdf streams.

Summary

Sets the maximum allowed size which can be occupied by all decompressed pdf streams.

Remarks

Sets the maximum allowed size which can be occupied by all decompressed pdf streams. This value can be limited by the maximum expected PDF file size when it's completely decompressed. Setting this value correlates with the maximum processing time spent on document reading iText will throw an exception if during decompression pdf streams with two or more filters of identical type occupy more memory than allowed.

Returns

this MemoryLimitsAwareHandler instance.

ConsiderBytesOccupiedByDecompressedPdfStream

Source code

internal MemoryLimitsAwareHandler ConsiderBytesOccupiedByDecompressedPdfStream(long numOfOccupiedBytes)

Arguments

Type

Name

Description

long

numOfOccupiedBytes

the number of bytes which are occupied by the decompressed pdf stream.

Summary

Considers the number of bytes which are occupied by the decompressed pdf stream.

Remarks

Considers the number of bytes which are occupied by the decompressed pdf stream. If memory limits have not been faced, throws an exception.

Returns

this MemoryLimitsAwareHandler instance.

See also
BeginDecompressedPdfStreamProcessing

Source code

internal MemoryLimitsAwareHandler BeginDecompressedPdfStreamProcessing()

Summary

Begins handling of current pdf stream decompression.

Returns

this MemoryLimitsAwareHandler instance.

EndDecompressedPdfStreamProcessing

Source code

internal MemoryLimitsAwareHandler EndDecompressedPdfStreamProcessing()

Summary

Ends handling of current pdf stream decompression.

Remarks

Ends handling of current pdf stream decompression. If memory limits have not been faced, throws an exception.

Returns

this MemoryLimitsAwareHandler instance.

See also
GetAllMemoryUsedForDecompression

Source code

internal long GetAllMemoryUsedForDecompression()

Generated with ModularDoc

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.