Convert DXF to PDF in C#

The GdPictureDocumentConverter class is a quick and easy one-step operation for converting AutoCAD DFX (Drawing Interchange Format, or Drawing Exchange Format) files into PDF or PDF/A. You can also choose the PDF conformance level you require.

Here’s the code for converting files to PDF:

// We assume GdPicture has been correctly installed and unlocked.
using (GdPictureDocumentConverter oConverter = new GdPictureDocumentConverter())
{
    // Select your source document and its document format (DXF).
    GdPictureStatus status = oConverter.LoadFromFile("input.dxf", GdPicture14.DocumentFormat.DocumentFormatDXF);
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("The file has been loaded successfully.", "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Information);
        // Select the conformance of the resulting PDF document.
        status = oConverter.SaveAsPDF("output.pdf", PdfConformance.PDF);
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}
'We assume GdPicture has been correctly installed and unlocked.
Using oConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    'Select your source document and its document format (DXF).
    Dim status As GdPictureStatus = oConverter.LoadFromFile("input.dxf", GdPicture14.DocumentFormat.DocumentFormatDXF)
    If status = GdPictureStatus.OK Then
        MessageBox.Show("The file has been loaded successfully.", "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Information)
        'Select the conformance of the resulting PDF document.
        status = oConverter.SaveAsPDF("output.pdf", PdfConformance.PDF)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "Conversion to PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Using