PDF has become one of the ruling document formats nowadays. The cross-platform support has made PDF a universal format. Therefore, various documents or images are converted to PDF before they are shared or exchanged. In this article, you will learn how to perform GIF to PDF conversion from within your C# applications. The article will also cover how to customize GIF to PDF conversion in various cases.
- C# GIF to PDF Converter API
- Convert GIF to PDF using C#
- Convert Specific Frames of GIF to PDF
- Set Page Size in GIF to PDF Conversion
- Set PDF Document Info in GIF to PDF Conversion
- Get a Free API License
Info: Aspose recently developed a FREE Text to GIF Converter.
C# GIF to PDF Converter API
Aspose.Imaging for .NET is a feature-rich image processing API that lets you process and convert a wide range of image formats. Particularly, the API provides a high fidelity conversion of GIF images to PDF format. You can either download the API or install it using NuGet.
PM> Install-Package Aspose.Imaging
Convert GIF to PDF using C#
The following are the steps to convert a GIF image to PDF using Aspose.Imaging for .NET.
- Use Image class to load the image.
- Create an instance of PdfOptions class.
- Convert GIF to PDF using Image.Save(String, PdfOptions) method.
The following code sample shows how to convert GIF to PDF using C#.
Convert Specific Frames of GIF to PDF in C#
You can also convert the specific frames from GIF to PDF. The following are the steps to perform this operation.
- Use Image class to load the image.
- Create an instance of PdfOptions class.
- Use PdfOptions.MultiPageOptions property to set a range of pages.
- Convert GIF to PDF using Image.Save(String, PdfOptions) method.
The following code sample shows how to convert specific frames of GIF to PDF using C#.
Set Page Size in GIF to PDF Conversion
Aspose.Imaging for .NET also allows you to set the dimensions of the page in the converted PDF file. The following are the steps to perform this operation.
- Use Image class to load the image.
- Create an instance of PdfOptions class.
- Use PdfOptions.PageSize property to set page size.
- Convert GIF to PDF using Image.Save(String, PdfOptions) method.
The following code sample shows how to set page size in GIF to PDF conversion.
Set Document Info in GIF to PDF Conversion
PDF format supports setting additional information about a document such as author, keywords, subject, and title. Using Aspose.Imaging for .NET, you can set these properties in GIF to PDF conversion. The following are the steps to set document information for the converted PDF file.
- Use Image class to load the image.
- Create an instance of PdfOptions class.
- Create an instance of PdfDocumentInfo class and set its properties.
- Assign PdfDocumentInfo object to PdfOptions.PdfDocumentInfo property.
- Convert GIF to PDF using Image.Save(String, PdfOptions) method.
The following code sample shows how to set document information in GIF to PDF conversion using C#.
Get a Free API License
In case you want to try the API without evaluation limitations, you can get a free temporary license.
Conclusion
In this article, you have learned how to convert GIF images to PDF documents using C#. Furthermore, you have seen how to convert specific frames of the GIF image and set page size or document information of converted PDF files. You can explore more about the C# image processing API using documentation. In case you would have any questions or queries, contact us via our forum.