Reference Guide
Programming / Document Conversion / Converting ANY supported document format to a PDF document
In This Topic
    Converting ANY supported document format to a PDF document
    In This Topic

    The feature of converting documents from different formats specifically to PDF format is probably the most frequent and asked. GdPicture.NET offers you this conversion from the wide variety of supported formats listed here. Using the GdPictureDocumentConverter class it is very quick and easy one-step operation. In addition, you can choose the PDF conformance level you require. Here is the fundamental workflow you need to follow.

    This class is only available in Ultimate edition of the toolkit.
    Copy Code
    'We assume that GdPicture has been correctly installed and unlocked.
    Using oConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
        'Select your source document and its document format.
        Dim status As GdPictureStatus = oConverter.LoadFromFile("input.docx", GdPicture14.DocumentFormat.DocumentFormatDOCX)
        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_A_1a)
            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
    Copy Code
    //We assume that GdPicture has been correctly installed and unlocked.
    using (GdPictureDocumentConverter oConverter = new GdPictureDocumentConverter())
    {
        //Select your source document and its document format.
        GdPictureStatus status = oConverter.LoadFromFile("input.docx", GdPicture14.DocumentFormat.DocumentFormatDOCX);
        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_A_1a);
            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);
        }
    }