英文:
Is it possible to embed a 360 degree viewer in a PDF using Python or some other language?
问题
我有保存为jpg文件的全景照片。我需要在PDF中嵌入一个360度查看器,以便查看全景照片。我正在使用Python进行工作,但我愿意通过Python运行C++代码、JavaScript或任何其他代码来实现这个目标。
我已经进行了一些研究,但我还没有找到可靠的解决方案。在这方面,任何坚实的指导将不胜感激。
英文:
I have panoramas saved as jpg files. I need to embed a 360 degree viewer in the PDF in which I can view the panorama. I am working in Python but I am happy to run C++ code, Javascript or any other code through Python to get this working.
I have done some research but what I have not yet came across a reliable solution. Any solid direction would be appreciated in this regard.
答案1
得分: 2
PDF中使用3D的历史经历了波折。有两种类型的发展,类似于VHS和BetaMax(对于那些记得这些问题的人来说)。
主要用于工程领域,无论是用于航空地形飞越还是机械装配,都可以查看独立或分段组件的内部。
目前,一些新型变种被吹捧为“市场上第一款”,尽管我在12年前就向Adobe支付了这样的功能费用(最早在2004年引入U3D,然后在2006年引入PRC),只是我很少使用它。
即使在高速CADD工作站上,运行时显示高密度细节通常也很慢。大多数CAD操作员都在线框模式下实时工作,只渲染高分辨率静态图像,用于报告或宣传册。与其他富媒体格式的PDF一样,您可以浮动媒体内容。
您可以看到下面的内容是遗留的PRC格式,因为它提到了“部件”用于自动动画景观,这个简单的东西被分类为3D注释。
/Type/3D/Filter/FlateDecode/Length 2433936/OnInstantiate 26 0 R/Resources<</Names[]>>/Subtype/PRC/VA
问题是,是否可以在Python或其他编程语言(如CMD)中构建这些文件?答案与我之前通过CMD文本脚本构建的其他PDF媒体插入的答案相同,可以组装对象,但通常不能构建组件流二进制部分,需要经过许多试验和许多错误。
因此,所有的3D PDF查看器(如Acrobat)都依赖于具有少量3D声明的PDF,甚至不必有任何页面内容。在我的框查看器中,我没有页面长度,因为当您将模型添加为3D注释时,Acrobat Reader会提供查看器。可以用任何编程语言(如CMD echo等)编写最小的查看器。
主要难题是核心数据都保存在U3D模型中。因此,我们需要一个建模库,因为我们在这里所能做的就是编写3D PDF视图包装,但像ISO这样的视图模式需要保存在模型内部,即使添加到包装器视图选择下拉菜单中。
英文:
The use of 3D in PDF has had a chequered history. There were 2 types developed like VHS & BetaMax (for those that remember such issues).
Primarily used in Engineering, either for Aerial terrain fly-past or Mechanical Assembly where one can look inside separate or sectioned components.
Currently some newer variants are touted as "First to market", even though I paid Adobe for such abilities more than 12 years ago (First introduced in 2004 as U3D then 2006 as PRC), just that I rarely use it.
Even with high speed CADD Workstations, it's usually slow for runtime showing high density details. Most Cad operators work live in Wireframe mode and only render high-res stills, for reports or brochures. Like other Rich Media Format PDFs you can float the media content.
You can see below it's the Legacy PRC format since it mentions "Parts" for AutoAnimated Landscape this simple one is classed as 3D annotation.
/Type/3D/Filter/FlateDecode/Length 2433936/OnInstantiate 26 0 R/Resources<</Names[]>>/Subtype/PRC/VA
The question was, can such files be built in Python or other programming like CMD? and the answer same as for other PDF media inserts I have built via a CMD text script, is yes for the assembly of the objects, but generally not for building the component stream binary parts, without lots of trials and many errors.
So All 3D PDF viewers like Acrobat depend on a PDF with a handful of 3D declarations There does not even have to be any page content Here iin my box viewer I have 0 page length since the Viewer is provided by Acrobat reader when you add the model as a 3d Annotation.
Minimal viewer written in any programming language such as CMD echo etc.
%PDF-1.7
%3DView
1 0 obj <</Type/Catalog/Pages 2 0 R>> endobj
2 0 obj <</Type/Pages/Kids [ 3 0 R ]/Count 1>> endobj
3 0 obj <</Type/Page/MediaBox [ 0 0 500 800 ]/Contents 4 0 R/Resources <</ProcSet [/PDF/Text/ImageB/ImageC/ImageI]>>/Parent 2 0 R/Annots [ 5 0 R ]>> endobj
4 0 obj <</Length 0>>stream
endstream
endobj
5 0 obj <</Rect[0 0 400 400]/Type/Annot/Subtype/3D/Contents (3D0surface)/3DA<</A/PV/TB true/NP true>>/3DD 6 0 R/AP<</N<< >>>>/NM (3D0surface)/T (3D0surface)>>endobj
6 0 obj <</Type/3D/Subtype/U3D/VA[<</TYPE/3DView/XN (DefaultView)/IN (DefaultView)/MS/U3D/U3DPath (DefaultView)/BG<</Type/3DBG/C [ 1 1 1 ]>>/SA [ ]>> ]/DV 0/Length 13212>>
stream
U3D
The major hurdle is the core data, is all held inside the U3D model. So we need a modelling library, since all we can do here is write the 3D PDF view wrap, but view modes like ISO would need to be saved within the model, even when added to the wrapper view selection dropdown.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论