Convert PNG to PDF in C#

GdPicture.NET SDK enables you to convert more than 50 image file formats to PDF documents. For more information, see the list of supported file types.

PSPDFKit SDKs are deployed in some of the world’s most popular applications, such as those made by Autodesk, Disney, UBS, Dropbox, IBM, and Lufthansa.

Key Capabilities

  • TIFF to PDF — Convert to PDF from TIFF

  • JPG to PDF — Convert to PDF from JPG

  • PNG to PDF — Convert to PDF from PNG

  • BMP to PDF — Convert to PDF from BMP

  • SVG to PDF — Convert to PDF from SVG

  • Any image to PDF — Convert to PDF from any image

Guides for Image-to-PDF Conversion

Convert from TIFF to PDF
How to convert to PDF from TIFF

Convert from JPG to PDF
How to convert to PDF from JPG

Convert from PNG to PDF
How to convert to PDF from PNG

Convert from BMP to PDF
How to convert to PDF from BMP

Convert from SVG to PDF
How to convert to PDF from SVG

Convert from any image to PDF
How to convert to PDF from any image

Free Trial

Start your free trial for unlimited access and expert support.

This article explains how to convert TIFF image files to PDF.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from a TIFF File

To create a PDF from a TIFF file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from a TIFF file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.tiff", GdPicture14.DocumentFormat.DocumentFormatTIFF);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.tiff", GdPicture14.DocumentFormat.DocumentFormatTIFF)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

The example below creates a PDF document from a TIFF file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.tiff", GdPicture14.DocumentFormat.DocumentFormatTIFF);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.tiff", GdPicture14.DocumentFormat.DocumentFormatTIFF);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics

This article explains how to convert JPG image files to PDF.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from a JPG File

To create a PDF from a JPG file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from a JPG file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

  • PdfUseDeflateOnJPEG is a Boolean value that specifies whether to use the deflate compression scheme in the output PDF file.

The example below creates a PDF document from a JPG file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics

This article explains how to convert PNG image files to PDF.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from a PNG File

To create a PDF from a PNG file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from a PNG file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.png", GdPicture14.DocumentFormat.DocumentFormatPNG);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.png", GdPicture14.DocumentFormat.DocumentFormatPNG)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

The example below creates a PDF document from a PNG file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.png", GdPicture14.DocumentFormat.DocumentFormatPNG);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.png", GdPicture14.DocumentFormat.DocumentFormatPNG);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics

This article explains how to convert BMP image files to PDF.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from a JPG File

To create a PDF from a BMP file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from a BMP file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

The example below creates a PDF document from a BMP file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics

This article explains how to convert SVG image files to PDF.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from an SVG File

To create a PDF from an SVG file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from an SVG file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.svg", GdPicture14.DocumentFormat.DocumentFormatSVG);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.svg", GdPicture14.DocumentFormat.DocumentFormatSVG)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

  • RasterizationDPI is an integer that specifies the resolution, expressed in dots per inch (DPI), with which to convert the source vector image to a raster image in the output PDF file.

The example below creates a PDF document from an SVG file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.svg", GdPicture14.DocumentFormat.DocumentFormatSVG);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.svg", GdPicture14.DocumentFormat.DocumentFormatSVG);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics

This article explains how to convert any image file to PDF. This article uses RAW files as an example. For more information, see the list of supported file types.

You’ll learn how to convert the image to a PDF document without optical character recognition (OCR). This means that the text in the image isn’t recognized, and you cannot search in the output PDF file. For more information, see the guide on converting images to searchable PDFs.

For more information on using mixed raster content (MRC) compression during the conversion, see the guide on hypercompression.

Creating a PDF from a RAW File

To create a PDF from a RAW file, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source document by passing its path to the LoadFromFile method. Recommended: Specify the source document format with a member of the DocumentFormat enumeration.

  3. Save the output in a new PDF document with the SaveAsPDF method.

The example below creates a PDF document from a RAW file:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.raw", GdPicture14.DocumentFormat.DocumentFormatRAW);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.raw", GdPicture14.DocumentFormat.DocumentFormatRAW)
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods

Related Topics

Optional PDF Configuration Properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • PdfBitonalImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for bitonal images in the output PDF file.

  • PdfColorImageCompression is a member of the PdfCompression enumeration that specifies the compression scheme used for color images in the output PDF file.

  • PdfEnableColorDetection is a Boolean value that specifies whether to use automatic color detection during the conversion that preserves image quality and reduces the output file size.

  • PdfEnableLinearization is a Boolean value that specifies whether to linearize the output PDF to enable Fast Web View mode.

  • PdfImageQuality is an integer from 0 to 100 that specifies the image quality in the output PDF file.

The example below creates a PDF document from a RAW file with a custom configuration:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.raw", GdPicture14.DocumentFormat.DocumentFormatRAW);
// Configure the conversion.
gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
gdpictureDocumentConverter.PdfImageQuality = 50;
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.raw", GdPicture14.DocumentFormat.DocumentFormatRAW);
    ' Configure the conversion.
    gdpictureDocumentConverter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG
    gdpictureDocumentConverter.PdfImageQuality = 50
    ' Save the output in a new PDF document.
    gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")
End Using
Used Methods and Properties

Related Topics