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

Members

Methods

Public methods
ReturnsName
longGetMaxSizeOfDecompressedPdfStreamsSum()
Gets the maximum allowed size which can be occupied by all decompressed pdf streams.
intGetMaxSizeOfSingleDecompressedPdfStream()
Gets the maximum allowed size which can be occupied by a single decompressed pdf stream.
MemoryLimitsAwareHandlerSetMaxSizeOfDecompressedPdfStreamsSum(long maxSizeOfDecompressedPdfStreamsSum)
Sets the maximum allowed size which can be occupied by all decompressed pdf streams.
MemoryLimitsAwareHandlerSetMaxSizeOfSingleDecompressedPdfStream(int maxSizeOfSingleDecompressedPdfStream)
Sets the maximum allowed size which can be occupied by a single decompressed pdf stream.
Internal methods
ReturnsName
MemoryLimitsAwareHandlerBeginDecompressedPdfStreamProcessing()
Begins handling of current pdf stream decompression.
MemoryLimitsAwareHandlerConsiderBytesOccupiedByDecompressedPdfStream(long numOfOccupiedBytes)
Considers the number of bytes which are occupied by the decompressed pdf stream.
MemoryLimitsAwareHandlerEndDecompressedPdfStreamProcessing()
Ends handling of current pdf stream decompression.
longGetAllMemoryUsedForDecompression()

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
TypeNameDescription
longdocumentSizethe 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
TypeNameDescription
intmaxSizeOfSingleDecompressedPdfStreamthe 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
TypeNameDescription
longmaxSizeOfDecompressedPdfStreamsSumhe 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
TypeNameDescription
longnumOfOccupiedBytesthe 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.