This quick tutorial guides you on how to insert image into PDF with C# REST API. You will learn to automatically add picture to PDF document with C# .NET-based API using the Cloud-based SDK. You will learn to upload images, and PDF files, define the image position, and target page number.
Prerequisite
- Create an account API credentials to add an image insdide the PDF
- Download Aspose.PDF Cloud SDK for Dotnet to insert an image
- Setup C# project with the above SDK for adding a picture
Steps to Insert a Picture in a PDF with C# REST Interface
- Configure the PdfApi class object for adding an image to a PDF
- Upload the target PDF file to the Cloud Storage with a specified name
- Upload the image file to the Cloud storage and assign it a name
- Call the PostInsertImage() method by providing the names of the PDF file, image, page number, and rectangular area
- Download the updated PDF file and save it on the disk
These steps summarize how to insert picture in PDF document with C# .NET-based API. Upload the source PDF file, and image, and define the rectangular area describing the position and dimension of the image. Check the status of the response and download the updated PDF file having the new image in it.
Code to Insert an Image in PDF with C# .NET-based API
This code demonstrates how to insert image in PDF document with C# RESTful Service. Use page index 1 instead of 0 to refer to the first page in the PDF, define the rectangle with respect to the bottom-left corner of the page as the origin, and set the height and width in points.
This article has taught us the process of inserting an image in a PDF. If you want to add a page in the PDF, refer to the article on how to Add New Page in PDF with C# REST API.