This quick tutorial guides you on how to convert JPG to PDF format with C# REST API. It shares the details to set the development environment, a list of steps to write the application, and a sample code for changing a JPEG to a PDF with C# Low Code API using a .NET-based cloud SDK. You will learn to convert a single or list of images to PDF where each image becomes a page in the newly created PDF.
Prerequisite
- Create an account API credentials export JPG to PDF
- Download Aspose.PDF Cloud SDK for Dotnet to convert a JPEG file to PDF
- Setup C# project with the above SDK for changing a JPEG to a PDF
Steps to Convert a JPG to a PDF with C# REST Interface
- Configure the PdfApi class object using the App key and Sid for converting JPG images to PDF
- Upload the image(s) to the Cloud storage with unique names
- Create the ImageTemplate objects for each image
- Create the list of ImageTemplate objects
- Create the ImageTemplatesRequest object using the images list and IsOCR flag
- Convert all the images to a PDF using the PutImageInStorageToPdf() method
- Download the PDF with an image on each page
These steps summarize how to convert Image to PDF with C# RESTful Service. Commence the process by uploading the single or multiple images to the Cloud storage, creating the ImageTemplate class objects for all the images, and creating a list of these objects. Subsequently, create an ImageTemplatesRequest request using the above ImageTemplate list and call the PutImageInStorageToPdf() method to convert the image to a PDF.
Code for JPG to PDF Document Converter with C# .NET-based API
This code demonstrates the process of developing a picture to PDF converter with C# Low Code API. To convert a single image to a PDF, you may follow the same process except upload the particular image to the cloud storage and create the required lists with a single item only. If you set the IsOCR flag to true, you may set the OCRLangs property to “string”.
This article has taught us the process of developing a picture to PDF file converter with C# RESTful Service. If you want to insert the image on an existing page along with other contents, follow the article on Insert Image into PDF with C# REST API.