0

I posted this onto the durandal discussion groups, but want to cover my bases on it: https://groups.google.com/forum/#!topic/durandaljs/PWgPUHcpzic

Basically, I want to see if anyone has successfully wrapped an existing control that is the complexity of the Mozilla PDF Viewer (http://mozilla.github.io/pdf.js/web/viewer.html) into a Durandal or Angular control, and been successful.

I know for other things, like date pickers, it's possible, but with this particular control, it's doing a lot with canvas and a few other interesting controls.

Any ideas on how I can accomplish this?

Can we use a knockout binding to accomplish this?

How do we control the positioning of this widget?

Richard B
  • 1,581
  • 1
  • 15
  • 31

1 Answers1

0

Yes, you would write a custom Knockout binding and wrap that binding in a Durandal widget. As for positioning, that's accomplished with CSS (or dynamically with a CSS Knockout binding).

  • Right, so the question really becomes how, using that control as-is, can you get it to fill a div that is a panel in an SPA app? e.g. if you can imagine building an Outlook client on a web form, where you read the email i want the pdf viewer control. – Richard B Jul 05 '14 at 20:40
  • @RichardB Well, to answer "how" would be bad form at this point for StackOverflow. According to the guidelines for this forum, then, you would need to make an attempt (first, by studying custom Knockout bindings) and then show your code and progress. As I have written many custom bindings, I would be happy to offer input and guidance once you've given me something to work with. –  Jul 06 '14 at 06:30
  • Hi @RichardB ! Were you able to embed the PDF.JS Viewer into a Durandal Widget? I have written my own PDF.JS Viewer, but in comparison to the pre-built one, it lacks quite some functionality e.g. text selection, zooming, on-resizing. So I am curious if it's even possible to embed the pre-built Viewer instead? – Ronald Hulshof Apr 30 '15 at 08:28
  • I had to abandon it, but do need to re-visit it at some point. I may hold off of the durandal one, and do it for Aurelia instead. Would be interested in a collaboration effort tho, @RonaldHulshof – Richard B Apr 30 '15 at 21:00
  • There are two ways of wrapping this into a widget. Try to recreate the Viewer inside a widget, like you (Durandal.PDFViewer) and I already started doing. But that actually turns out to be total overkill. At least for me the only thing needed to put into a Widget is something like this: `` – Ronald Hulshof May 02 '15 at 10:16