ImageGear .NET v24.12 - Updated
CAD to 3D PDF
User Guide > How to Work with... > CAD > How To ... > Convert ... > CAD to 3D PDF

The following CADto3DPDF sample illustrates how you can create a 3D PDF from a CAD page:

C#
Copy Code
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;

public static void CadTo3DPdf(string inFile, string outFile)
{
    ImGearCADPage page = null;

    // Load the file.
    using (FileStream fileStream = new FileStream(inFile, FileMode.Open, FileAccess.Read))
    {
        page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
    }

    // Save the CAD file as a 3D PDF file.
    CADPDFSaveOptions options = new CADPDFSaveOptions();
    options.PRCMode = CADPDFSaveOptions.PRCModeOption.BREP;
    page.SaveOptions["PDFSaveOptions"] = options;

    using (FileStream fileStream = new FileStream(outFile, FileMode.Create, FileAccess.Write))
    {
        ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.PDF);
    }
}
VB.NET
Copy Code
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD

Public Sub CadTo3DPdf(inPath As String, outPath As String)
    Dim page As ImGearCADPage

    ' Load the file.
    Using fileStream As New FileStream(inPath, FileMode.Open, FileAccess.Read)
        page = ImGearFileFormats.LoadPage(fileStream)
    End Using

    ' Save the CAD file as a 3D PDF file
    Dim options As CADPDFSaveOptions = New CADPDFSaveOptions()
    options.PRCMode = CADPDFSaveOptions.PRCModeOption.BREP
    page.SaveOptions.Add("PDFSaveOptions", options)

    Using fileStream As New FileStream(outPath, FileMode.Create, FileAccess.Write)
        ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.SVG)
    End Using
End Sub
Setting the PRCMode option to either BREP or MESH should output a 3D PDF. It is recommended that PRCAllInSingleView be set to true so the CAD page will export to a single PDF page.