Are some Global objects overridden

Product: Webviewer/ PDFNet SDK

Product Version: 10.0.0

Please give a brief summary of your issue:
Global objects are overridden ?
Facing Issue with object CanvasRenderingContext2d

Please describe your issue and provide steps to reproduce it:
We see a behavior where once webviewer is included, it overrides some canvas functions

Example :-
CanvasRenderingContext2d.getTransform gives a different object when webviewer is loaded
and when it is used without webviewer

This is creating some issues with our existing code.

Is there a way to prevent overriding global objects or any other way to scope it.

Thanks in advance for help!

Hi @smit.shah,

Thanks for reaching out to WebViewer Support!

Are you able to provide us a sample where we can reproduce this issue? Ideally we are not overriding CanvasRenderContent2d (or any global objects) but I would need to investigate further.

Thanks,
Adam

Thank you for your response.

Please use below codesandbox link to check sample to reproduce the issue
https://codesandbox.io/s/goofy-morning-vrdpn4

  1. Check console object returned when webviewer-core.min.js is included
  2. Comment script inclusion, and check console log.

We see different object returned in both cases. Can you please help us with the same.

Thank you.

Hi @smit.shah,

My apologies for the late response!

Thank you for providing a working sample. I’m able to reproduce the behaviour you described. After discussing with my team, this minification/overwrite is intentional as getTransform and other canvas APIs were not always standard in modern browsers. In theory the function should behave the same way.

However, could you provide us more detail on how this is impacting your project / what issues or errors are you experiencing?

Hi @asinclair , thank you for your response.
Some of our existing code is breaking for example, we are calling transformPoint on the object returned by getTransform method.
But it is not available in the overriden object.

Hi @smit.shah,

Thanks for confirming with us. I’ve added this issue to our backlog for us to review and plan out a fix. We most likely don’t need to polyfill these APIs anymore since most browsers officially support this.

I don’t have an exact timeline when it will be fixed but we’ll let you know when it’s available in an nightly stable build. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.

Let me know if there are any questions,
Adam

That would be great. It would really help if this is released as early as possible.
Thanks again for you response

Hi @smit.shah,

It would really help if this is released as early as possible.

Thank you - I’ve added this to the ticket for visibility. We appreciate your patience in the meantime!

Adam