iText 8.0.4 API
iText.Kernel.Pdf.MemoryLimitsAwareHandler Class Reference

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

Public Member Functions

  MemoryLimitsAwareHandler ()
  Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams. More...
 
  MemoryLimitsAwareHandler (long documentSize)
  Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams. More...
 
virtual int  GetMaxSizeOfSingleDecompressedPdfStream ()
  Gets the maximum allowed size which can be occupied by a single decompressed pdf stream. More...
 
virtual iText.Kernel.Pdf.MemoryLimitsAwareHandler  SetMaxSizeOfSingleDecompressedPdfStream (int maxSizeOfSingleDecompressedPdfStream)
  Sets the maximum allowed size which can be occupied by a single decompressed pdf stream. More...
 
virtual long  GetMaxSizeOfDecompressedPdfStreamsSum ()
  Gets the maximum allowed size which can be occupied by all decompressed pdf streams. More...
 
virtual iText.Kernel.Pdf.MemoryLimitsAwareHandler  SetMaxSizeOfDecompressedPdfStreamsSum (long maxSizeOfDecompressedPdfStreamsSum)
  Sets the maximum allowed size which can be occupied by all decompressed pdf streams. More...
 
virtual bool  IsMemoryLimitsAwarenessRequiredOnDecompression (PdfArray filters)
  Performs a check if the PdfStream with provided setup of the filters requires memory limits awareness during decompression. More...
 
virtual int  GetMaxNumberOfElementsInXrefStructure ()
  Gets maximum number of elements in xref structure. More...
 
virtual long  GetMaxXObjectsSizePerPage ()
  Gets maximum page size. More...
 
virtual void  SetMaxXObjectsSizePerPage (long maxPageSize)
  Sets maximum page size. More...
 
virtual void  SetMaxNumberOfElementsInXrefStructure (int maxNumberOfElementsInXrefStructure)
  Sets maximum number of elements in xref structure. More...
 
virtual void  CheckIfXrefStructureExceedsTheLimit (int requestedCapacity)
  Performs a check of possible extension of xref structure. More...
 
virtual void  CheckIfPageSizeExceedsTheLimit (long totalXObjectsSize)
 

Detailed Description

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

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

A configured MemoryLimitsAwareHandler can be set as a property of ReaderProperties instance which is passed to PdfReader.

See also
ReaderProperties.SetMemoryLimitsAwareHandler(MemoryLimitsAwareHandler)

Constructor & Destructor Documentation

◆ MemoryLimitsAwareHandler() [1/2]

iText.Kernel.Pdf.MemoryLimitsAwareHandler.MemoryLimitsAwareHandler ( )
inline

Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams.

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]

iText.Kernel.Pdf.MemoryLimitsAwareHandler.MemoryLimitsAwareHandler ( long  documentSize )
inline

Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams.

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.

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

Member Function Documentation

◆ CheckIfXrefStructureExceedsTheLimit()

virtual void iText.Kernel.Pdf.MemoryLimitsAwareHandler.CheckIfXrefStructureExceedsTheLimit ( int  requestedCapacity )
inlinevirtual

Performs a check of possible extension of xref structure.

Parameters
requestedCapacity capacity to which we need to expand xref array.

◆ GetMaxNumberOfElementsInXrefStructure()

virtual int iText.Kernel.Pdf.MemoryLimitsAwareHandler.GetMaxNumberOfElementsInXrefStructure ( )
inlinevirtual

Gets maximum number of elements in xref structure.

Returns
maximum number of elements in xref structure.

◆ GetMaxSizeOfDecompressedPdfStreamsSum()

virtual long iText.Kernel.Pdf.MemoryLimitsAwareHandler.GetMaxSizeOfDecompressedPdfStreamsSum ( )
inlinevirtual

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

Returns
the maximum allowed size value which streams may occupy

◆ GetMaxSizeOfSingleDecompressedPdfStream()

virtual int iText.Kernel.Pdf.MemoryLimitsAwareHandler.GetMaxSizeOfSingleDecompressedPdfStream ( )
inlinevirtual

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.

◆ GetMaxXObjectsSizePerPage()

virtual long iText.Kernel.Pdf.MemoryLimitsAwareHandler.GetMaxXObjectsSizePerPage ( )
inlinevirtual

Gets maximum page size.

Returns
maximum page size.

◆ IsMemoryLimitsAwarenessRequiredOnDecompression()

virtual bool iText.Kernel.Pdf.MemoryLimitsAwareHandler.IsMemoryLimitsAwarenessRequiredOnDecompression ( PdfArray  filters )
inlinevirtual

Performs a check if the PdfStream with provided setup of the filters requires memory limits awareness during decompression.

Parameters
filters is an PdfArray of names of filters
Returns
true if PDF stream is suspicious and false otherwise

◆ SetMaxNumberOfElementsInXrefStructure()

virtual void iText.Kernel.Pdf.MemoryLimitsAwareHandler.SetMaxNumberOfElementsInXrefStructure ( int  maxNumberOfElementsInXrefStructure )
inlinevirtual

Sets maximum number of elements in xref structure.

Parameters
maxNumberOfElementsInXrefStructure maximum number of elements in xref structure.

◆ SetMaxSizeOfDecompressedPdfStreamsSum()

virtual iText.Kernel.Pdf.MemoryLimitsAwareHandler iText.Kernel.Pdf.MemoryLimitsAwareHandler.SetMaxSizeOfDecompressedPdfStreamsSum ( long  maxSizeOfDecompressedPdfStreamsSum )
inlinevirtual

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

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 which were identified as requiring memory limits awareness occupy more memory than allowed.

Parameters
maxSizeOfDecompressedPdfStreamsSum he maximum allowed size which can be occupied by all decompressed pdf streams.
Returns
this MemoryLimitsAwareHandler instance.
See also
IsMemoryLimitsAwarenessRequiredOnDecompression(PdfArray)

◆ SetMaxSizeOfSingleDecompressedPdfStream()

virtual iText.Kernel.Pdf.MemoryLimitsAwareHandler iText.Kernel.Pdf.MemoryLimitsAwareHandler.SetMaxSizeOfSingleDecompressedPdfStream ( int  maxSizeOfSingleDecompressedPdfStream )
inlinevirtual

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

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 which was identified as requiring memory limits awareness occupies more memory than allowed.

Parameters
maxSizeOfSingleDecompressedPdfStream the maximum allowed size which can be occupied by a single decompressed pdf stream.
Returns
this MemoryLimitsAwareHandler instance.
See also
IsMemoryLimitsAwarenessRequiredOnDecompression(PdfArray)

◆ SetMaxXObjectsSizePerPage()

virtual void iText.Kernel.Pdf.MemoryLimitsAwareHandler.SetMaxXObjectsSizePerPage ( long  maxPageSize )
inlinevirtual

Sets maximum page size.

Parameters
maxPageSize maximum page size.