Is it possible to embed a 360 degree viewer in a PDF using Python or some other language?

92 Views Asked by At

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

There are 1 best solutions below

0
K J On

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.

enter image description here

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

enter image description here

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 (3D\040surface)/3DA<</A/PV/TB true/NP true>>/3DD 6 0 R/AP<</N<< >>>>/NM (3D\040surface)/T (3D\040surface)>>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             

enter image description here

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.

enter image description here