Load a Bitmap (BMP) for Conversion in C#

To load and convert a PDF document from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to a PDF document to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert a PDF document from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatPDF;
// Load a PDF document from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.pdf", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatPDF
    ' Load a PDF document from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.pdf", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert a Word document from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to a Word document to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert a Word document from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatDOCX;
// Load a Word document from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.docx", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatDOCX
    ' Load a Word document from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.docx", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert an image from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to an image to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert an image from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatJP2;
// Load an image from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.jpeg", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatJP2
    ' Load an image from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.jpeg", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert a bitmap image from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to a bitmap image to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert a bitmap image from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatBMP;
// Load a bitmap image from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.bmp", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatBMP
    ' Load a bitmap image from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.bmp", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert an SVG image from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to an SVG image to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert an SVG image from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatSVG;
// Load an SVG image from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.svg", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatSVG
    ' Load an SVG image from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.svg", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert a TIFF image from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to a TIFF image to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

To load and convert a TIFF image from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatTIFF;
// Load a TIFF image from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.tiff", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatTIFF
    ' Load a TIFF image from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.tiff", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using

To load and convert any file from your local storage to a different file type, use the LoadFromFile method from the GdPictureDocumentConverter class. This method requires the following parameters:

  • FilePath — The path to the file to convert.

  • DocumentFormat — The file format represented as a member of the DocumentFormat enumeration.

The list of supported files is available on the Supported File Types page.

To load and convert an Excel file from your local storage, use the following code:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Specify the file format.
GdPicture14.DocumentFormat format = GdPicture14.DocumentFormat.DocumentFormatXLSX;
// Load an Excel file from a file.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.xlsx", format);
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Specify the file format.
    Dim format As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatXLSX
    ' Load an Excel file from a file.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.xlsx", format)
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using