unipdf icon indicating copy to clipboard operation
unipdf copied to clipboard

[FEATURE] Early-termination while processing contentstream

Open gunnsth opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. The problem is inefficiency when simply looking for a single operand and then stopping processing. For example, if only looking for a single colored pixel in a page.

Describe the solution you'd like It would make sense to be able to set a stop flag on the processor and return out of the handler, which would cause the processor to return out without further processing.

Describe alternatives you've considered An alternative implementation using channels has been done by a collaborator. https://github.com/peterwilliams97/unipdf/blob/early.termination/contentstream/parser.go https://github.com/peterwilliams97/unidoc-examples/blob/imagemark.classify/testing/pdf_count_color_pages_bench.go

If the simple stop flag would be enough to get this done, I believe it would be more simple method.

Additional context N/A

gunnsth avatar Oct 21 '19 00:10 gunnsth