Help! How do I extract 3D objects from PDFs?


You know how the Democratic People's Republic of Korea is neither democratic, nor particularly for the people, nor a republic? Yeah, so it turns out the "Universal 3D" format is pretty far from Universal!

A little backstory... The Europeana Carare Project has some gorgeous 3D scans of ancient monuments and heritage sites. The only problem is that the 3D files are trapped inside PDFs. Yup - did you know the PDF spec supported 3D models? Me neither.

The only way to view these is with the Official Adobe Viewer (install it on Linux following these instructions).

This is what it looks like:

Nifty, right?

So, how do we extract that 3D file?

  1. Download and install the Pythong PDF Parser
  2. Search for the 3D object:
    ./pdf-parser.py -t /3D input.pdf
  3. You'll get a response like this:
    obj 48 0
     Type: /3D
     Referencing: 58 0 R, 59 0 R
     Contains stream
    
      <<
        /AN 58 0 R
        /Length 6066066
        /Subtype /PRC
        /Type /3D
        /VA 59 0 R
      >>
    
  4. The Object ID (in this case 48) is what we need to extract.
  5. ./pdf-parser.py -o 48 -d output.u3d input.pdf

You can download the U3D file.

Unfortunately, nothing opens it. I've tried Meshlab, Blender, FreeCAD, i3D Converter, online service Babel3D, and even Unity 3D on a Windows box.

Nothing! Not a single application would recognise it - let alone convert it.

There is a U3D library on GitHub - but I'm not skilled enough to integrate it into anything.

I've found an Android app which claims to convert U3D files - but it has no downloads, no reviews, and costs £6!

So, gentle reader, if you know of a way to extract and view 3D models from PDFs, please let me know!

15 thoughts on “Help! How do I extract 3D objects from PDFs?

    1. Really? Would you mind explaining how you did it? I couldn't get Babel to work - and I don't think Glovius have a Linux version.

  1. Sorry Im not a coder but an artist and I need to extract a 3d model from a pdf.
    I don't understand much about coding and all, so can you explain to me how to proceed in layman's terms?

    -I downloaded python
    -Opened IDLE and I ran the pdf-parser.py program
    -A window with some help instructions opens

    Now, I tried your line of code "./pdf-parser.py -t /3D input.pdf" and it didn't work, even if I change the /3D input.pdf to /my_pdf_file.pdf ,
    I tried to use it without the "." in the beginning as well, to no avail.
    I've tried using just "pdf-parser.py -t pdf-file.pdf" and variations like "pdf-parser.py -t /c/folder/pdf-file.pdf" or "pdf-parser.py -t /folder/pdf-file.pdf" to no avail.

    My pdf is inside the directory C:\TestFolder. How can I access it with the -t command in pdf-parser.py?

      1. Terence is using it in Linux, you (Luiz) are using it in Windows. Just don't write the "./" at the beginning. I think though that the Parser is not extracting the U3D correctly, casue I'm not able to reembed the U3D in a new PDF.

  2. Yeah, that seems to be the problem. The 3D object is actually in the PRC format. I'd no luck finding a PRC viewer nor a converter. But you should try extracting the geometry from the 3d pdf as PRC file and keep it until you find a software that reads it

What do you reckon?

%d bloggers like this: