Convert JPG to PDF Format with C# REST API

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

Steps to Convert a JPG to a PDF with C# REST Interface

  1. Configure the PdfApi class object using the App key and Sid for converting JPG images to PDF
  2. Upload the image(s) to the Cloud storage with unique names
  3. Create the ImageTemplate objects for each image
  4. Create the list of ImageTemplate objects
  5. Create the ImageTemplatesRequest object using the images list and IsOCR flag
  6. Convert all the images to a PDF using the PutImageInStorageToPdf() method
  7. 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.