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!


Share this post on…

  • Mastodon
  • Facebook
  • LinkedIn
  • BlueSky
  • Threads
  • Reddit
  • HackerNews
  • Lobsters
  • WhatsApp
  • Telegram

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

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

      Reply
      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"

        Reply
    2. Ethan says:

      I tried glovius, but whenever I uploaded my files, I couldn't view it.

      Reply
    1. Terence Eden says:

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

      Reply
  2. 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?

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

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

        Reply
    1. Terence Eden says:

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

      Reply
  3. 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

    Reply
  4. George says:

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

    Reply
    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)

      Reply
      1. @edent says:

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

        Reply
      2. Dan says:

        Thanks! This worked for me too. I had to unlock the PDF first using the SmallPDF website in order to open it with Photoshop. I had no idea that Photoshop could do this kind of 3D conversion.

        Reply
      3. says:

        You note to see the import setting is what saved my bacon today! Didn't realize there was a "3D" checkbox on the import dialoge when you import a PDF until I looked for it after reading your comment. I've spent hours today trying to pull a couple 3D models out of some PDFs today and that did the trick! (I had install Photoshop 22.0)

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

    Reply
    1. Su says:

      I have completed the 3rd step. Can you please elaborate as to what to do after that?

      Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">