Skip to content
This repository was archived by the owner on Mar 22, 2019. It is now read-only.
This repository was archived by the owner on Mar 22, 2019. It is now read-only.

Problem with PdfDocument loading file with size more than 5 MB. #27

@ksondz

Description

@ksondz

When we try loading pdf file size more than 5 MB there is problem.
PdfDocument runs _loadOutlines with PDF trailer root.
Then in the _loadOutlines function it trys to getType from OutLines - $root->Outlines->getType()
Then there is $this->_ref which is null and it runs $this->_dereference();

Problem in this method _dereference()
There are 3 conditions in this method:

  1. It checks fetchObject is null and if it is null it gets object from context's parser.
  2. it checks obj is null and if it is null it set $this->_ref = new NullObject();
  3. it check like this : if ($obj->toString() != $this->_objNum . ' ' . $this->_genNum . ' R') {

The problem that in my case when file size more than 5 MB.
After first condition obj is set new InternalType\NullObject();
Second condition is skipped because obj is not null
In the third condition it uses method toString() and it returns null and this condition returns exception "Incorrect reference to the object" .

In my opinion it returns this exception because PdfParser\StructureParser sets wrong context. It doesn't set RefTable to the context and then $offset is null inside getObject and it returns NullObject.

Please check loading pdf file with size more than 5 MB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions