Class SoToPDFAction

  • public class SoToPDFAction
    extends SoToU3DAction
    Class for exporting a scene graph to a PDF file. This class can export an Open Inventor scenegraph into a simple PDF file. In addition to 3D scene encapsulation, the exporter can insert a title to the document and an unique block of text. Moreover, PDF encryption can lock access to the file contents. To import a 3D model inside a more complex PDF file, prefer SoToU3DAction. U3D files can be used to import 3D models inside PDF files by advanced PDF editors.


    • Inherits limitations of SoToU3DAction. Please read these carefully.

    Use case

     // setup the root scene graph to export
     SoSeparator root = new SoSeparator();
     SoToPDFAction pdfAction = new SoToPDFAction();
     boolean result = pdfAction.openFile( "output.pdf" );
     if ( !result ) 
       // error management
     pdfAction.setTitle( "Scene Name" );
     pdfAction.setText( "Some text describing the exported scene." );
     pdfAction.apply( root );
     result = pdfAction.closeFile();
     if ( !result )
       // error management


    • On some platforms, some third parties may encounter problems to load displaying an error message like: "IFXOSFileIterator.ProcessDir: error opening /usr/local/u3d/lib/Plugins/ No such file or directory". In such case, declare the environment variable U3D_LIBDIR (UNIX only) and set it with the path to the Open Inventor libraries ($OIVHOME/lib).
    • Limitations are common to SoToU3DAction.

    See Also:
    • Constructor Detail

      • SoToPDFAction

        public SoToPDFAction()
    • Method Detail

      • setPassword

        public void setPassword​(java.lang.String writePass)
        Calls setPassword(writePass, (java.lang.String)null).
      • setText

        public void setText​(java.lang.String text)
        [Optional] Add a text block into the output PDF file.
      • setTitle

        public void setTitle​(java.lang.String title)
        [Optional] Set a title into the output PDF file.
      • setLandscape

        public void setLandscape​(boolean enable)
        [Optional] Changes the page orientation from portrait to landscape.
      • setPassword

        public void setPassword​(java.lang.String writePass,
                                java.lang.String readPass)
        [Optional] Set passwords to lock write & read access to the PDF file contents. Passwords are optional. A write password is required before setting a read password. Write and read passwords must be different.
      • enableElement

        public static void enableElement​(java.lang.Class<? extends Inventor> t,
                                         int stkIndex)