Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handler to make text div building more flexible #8656

Closed
wants to merge 1 commit into from
Closed

Added handler to make text div building more flexible #8656

wants to merge 1 commit into from

Conversation

AsterAI
Copy link

@AsterAI AsterAI commented Jul 16, 2017

No description provided.

@timvandermeij
Copy link
Contributor

I'm not entirely sure what the purpose of this patch is. Could you elaborate a bit on what problem this solves?

@Snuffleupagus
Copy link
Collaborator

I'm not entirely sure what the purpose of this patch is. Could you elaborate a bit on what problem this solves?

Furthermore, even with the necessary details explaining the purpose of the patch, there's the additional problem of this basically being dead code; #8413 (comment) seems very much relevant here as well.

@AsterAI
Copy link
Author

AsterAI commented Jul 16, 2017

@timvandermeij
Hi Tim, this patch allow pdf.js delegate some responsibility during it builds text divs.
Now EVERYTHING are controlled by pdf.js. This patch allow to change div creation logic by side "clients" of pdf.js lib

Example:
apply some classes to divs, that depends on low level transform matrix .e.t.c
Now, to change logic i have to patch appendText function in my private forks.

P.S. in the future I see pdf.js architecture that fully match to Open/Close principle.
To do this we have to review pds.js architecture to plugin / component / module oriented architectures.

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handler-based is somewhat a new pattern to the PDF.js. We can add e.g. onProgress event to the task returned by readerTextLayer (to match what we do with loading task) and not perform handler presents check for every item, but for block of items e.g. at _processItems level. If consumer wants to perform additional actions, they can monitor onProgress event on the task.

We did factory based approach so we don't need to change anything in web/ for custom solutions. I'm think, you will not need that with onProgress callback, or just inherit existing TextLayerBuilder to specify additional onProgress monitoring thing for a rendering task.

@AsterAI
Copy link
Author

AsterAI commented Jul 18, 2017

Ok, i will try to implement new event onGlyphProcess event

@AsterAI AsterAI closed this Aug 18, 2017
@AsterAI AsterAI deleted the div_builder_handler branch August 18, 2017 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants