简体   繁体   English

如何在Autodesk Forge Viewer中嵌入pdf?

[英]How to embed a pdf in the Autodesk Forge Viewer?

I am currently having trouble getting started with writing an extension that shifts the viewer to a pdf view. 我目前在编写扩展程序时遇到麻烦,该扩展程序可将查看器转换为pdf视图。 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. 单击或激活扩展按钮时,它或多或少地使查看器看起来像是这里的第一张图像,再次单击/禁用它时,它会恢复为常规3D查看器。

I tried looking into the code in the above link but I don't understand where the modelDocument object came from. 我尝试查看以上链接中的代码,但不了解modelDocument对象的来源。 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. 我正在完全脱机使用Forge Viewer,所以我没有处理任何URN,身份验证机制等。我已经编写了一些扩展程序,这些扩展程序可以以某种方式更改浏览器中的3D模型,但是此新扩展程序有所不同。

Thank you in advance! 先感谢您!

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. 查看器一次只能加载多个模型,但必须同时是2D或两个3D,如果加载了3D模型,则无法在同一实例中加载2D模型。

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 . 您可以简单地实例化第二个查看器,以加载pdf视图,覆盖div或导航到另一个页面或像我的演示中并排显示它。 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'). 如果您离线使用查看器,那么我假设您以某种方式下载了与翻译后的pdf对应的可见资源,在这种情况下,您可以使用viewer.loadModel('路径/到/你/ .f2d /资源“)。

Hope that helps 希望能有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM