0

I am currently having trouble getting started with writing an extension that shifts the viewer to a pdf view. More or less, the extension button in mind, when clicked/activated, makes the viewer look like the first image here, and when it is clicked again/deactivated, it reverts back to the regular 3D viewer.

I tried looking into the code in the above link but I don't understand where the modelDocument object came from. I am using the Forge Viewer completely offline, so I am not dealing with any URNs, authentication mechanisms, etc. I already wrote extensions that can change the 3D model in the browser in some way, but this new extension is different.

Thank you in advance!

Xiggi
  • 1
  • Welcome to SO! Post the code you've tried and a specific problem you're having in your question for us to help you better and faster – Colwin Jun 26 '17 at 15:56

1 Answers1

0

The viewer can only load multiple models at a time but they have to be both 2D or both 3D, you cannot load a 2D model in the same instance if you loaded a 3D model.

You could simply instantiate a 2nd viewer that will load the pdf view, either overlay a div, or navigate to another page or display it side by side like in my demo. That's really up to you.

If you use the viewer offline, then I'm assuming you somehow downloaded the viewable resources that correspond to the translated pdf, in which case you can simply load a 2D model the same way you load the 3D one, using viewer.loadModel('path/to/your/.f2d/resource').

Hope that helps

Felipe
  • 4,325
  • 1
  • 14
  • 19
  • Thanks for your reply! I haven't had experience on how to instantiate a new viewer. I've only played around with extensions where the viewer was already instantiated for me so I don't know how to instantiate another viewer. I basically want the model to be replaced with a pdf (while all the extension buttons remain) and have the option to load back to another model. I know this is not specific so if there's any Forge documentation that I missed that would help me get started that would be great, too! – Xiggi Jun 27 '17 at 07:51