Adding splitting PDF documents in specified chunks. #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is aimed to add to the split method the capability of splitting in chunks. The chunk size is specified when calling the method. It will split the PDF in N amount of chunks of the specified amount of pages, it includes both boundaries. It also takes into account that probably chunks will not be of the same size due to exceeding amount of pages so the last PDF will have the remaining amount of pages.
I have also added tests.
The reason of this PR is because I have been working with Deepdoctection and saw it has a split method however it splits the PDF in single pages which is very useful however I needed the PDF split in chunks and I could not find a library that does that so I thought that perhaps this might be useful to someone else and perhaps could be a good PR.
I am sure the code can be improved as well, this can be a good a first approach at least.
Also I have noticed there was a function (
_reset_df_and_get_length
) that was defined as internal and was not being used so I removed it.I hope this is good! :D Thanks again for creating this amazing library.