The class SoToPDFAction( C++ | Java | .NET ) exports an Open Inventor scene graph directly into a simple PDF file. SoToPDFAction( C++ | Java | .NET ) can also set the document title, specify the text of the document, and lock access to the file content.
Example 4.5. Generation of PDF3D output
SoSeparator* root = ... // scenegraph init SoToPDFAction pdfAction; bool 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
The sample demo $OIVHOME/src/HardCopy/PDFExport
shows how to convert an Open Inventor file. This demo brings up the dialog box shown below.
Fill in a few fields and click on the Export button.
This demo can also be used as a command line tool. The first argument is the Open Inventor input filename. The second (optional) argument is the output PDF filename. For example:
PDFExport harley.iv output.pdf