Convert HTML to PDF with NET REST API

In this short tutorial, you will learn how to convert HTML to PDF with NET REST API. We have used C# Cloud SDK to create PDF files from HTML. You can use the shared environment details and list of steps to perform this task by using the C# Low Code API.

Prerequisite

Steps to Convert HTML File to PDF with C# REST API

  1. Set Client ID and Client Secret for the API
  2. Create an object of the PdfApi class with client credentials
  3. Specify input and output files
  4. Read the input HTML file and upload it to a cloud storage
  5. Utilize the GetHtmlInStorageToPdf method to convert HTML to PDF file with NET REST API
  6. Download and Save the output PDF file on the local disk

Code to Generate PDF from HTML with C# Low Code API

This code has enabled us to write an application for creating a PDF file from an HTML file using the C# REST API. In the first step, the source HTML file is uploaded to the cloud storage using the UploadFile() method, converted to PDF and downloaded using the GetHtmlInStorageToPdf() method. Save this stream of bytes as a PDF file whose page width and height are specified in the code.

You can perform this HTML to PDF conversion in any of the platforms supporting the no code or low code apps including Windows, Linux or Mac.

Another relevant feature can be found at the following URL: How to Convert PDF to HTML with NET REST API.

 English