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

by @edent | # # # # | 19 comments | Read ~7,254 times.

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!

Support this blog

Enjoyed this blog post? You can say thanks to the author in the following ways:

Donate to charity
Give to charity.
Buy me a birthday present
Amazon Wishlist
Get me a coffee
Donate on Ko-Fi.

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

  1. John says:

    I think the problem is that the 3d models are in the PRC format instead of u3d. The only converter I could find that worked is https://www.convertcadfiles.com. I managed to convert one of the smaller pdf files on the Carare site to an stl file.

  2. Rahul says:

    Babel3D and Glovius worked for me!!!

    1. Terence Eden says:

      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. George says:

        Rahul, lying does not help nor does assist in the reason for this thread. Please don't mislead members. This is directly from Kapil at Glovious:
        Me- Do you have a product that can extract 3d data out of a PDF?
        Kapil - Hello,
        No, this is not possible in Glovius.

        From his email "Kapil from Glovius kapil.desai@glovius-375ec105c5de.intercom-mail.com"

  3. Simlab Composer 7 (full functional 21 day trial) - http://www.simlab-soft.com did the job for me. It was really handy.

    1. Terence Eden says:

      Sadly I can't get that to work in Linux. Are you able to share any of the 3D models?

  4. 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 Eden says:

      Hi, I wasn't able to make it work either. Sorry.

      1. But you were able to extract the U3D from the PDF right? Can you explain with a little more detail the usage of Pythong PDF Parser? I can't even make it find the pdf, none of the commands worked...

      2. Viktor says:

        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.

    1. Terence Eden says:

      Doesn't work on Linux and appears to require an obsolete version of Adobe Acrobat...

  5. 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

  6. David Malpica says:

    I used Photoshop CC to extract 3D data from a PDF.

  7. George says:

    Photoshop CC doesn't do that... It will only import the pdf as pages. It cannot parse the vertex data.

    1. yareckk says:

      Definitely works with Photoshop CC. Import 3D object from PDF (see PDF import settings) than you can export a 3D layer (3D menu in PS) as .obj or colada (.dae)

      1. @edent says:

        Sadly Photoshop doesn't work on Linux. If you can extract the files - could you share them?

      2. Angus says:

        Thank you man, this worked for me.

  8. Federico says:

    I could fix the Acrobat's "3d data parsing error" using pdf-parser.py and qpdf:

    1) Uncompress the original 3dpdf:
    qpdf --stream-data=uncompress unc.pdf original3dpdf.pdf

    2) Obtain the 3D object ID in the uncompressed 3dpdf (6 in my case):
    ./pdf-parser.py -t /3D unc.pdf

    3) Extract u3d file with pdf-parser.py:
    pdf-parser.py -o 6 -d unc.u3d unc.pdf

    After that I compiled the .tex (beamer) with pdflatex and it works perfect in Acrobat.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.