HTML
JPG
PDF
XML
DOCX
PDF
Work with pages in PDF docuemnts via .NET SDK
API for working with pages in the PDF documents via .NET.
Get StartedHow to work with Pages in the PDF documents using Cloud .NET SDK
In order to manipulate Pages in the PDF documents via Cloud .NET SDK , we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Pdf-Cloud
Steps to add image stamp to pages using .NET SDK
Aspose.PDF Cloud developers can easily load & append image stamp to pages of the PDF documents in just a few lines of code.
- Create a new Configuration object with your Application Secret and Key.
- Create an object to connect to the Cloud API.
- Uploads the PDF to cloud storage.
- Perform append page in the PDF on cloud storage.
- Checks the response and logs the result.
- Downloads the updated file for local use.
This sample code shows adding image stamp on pages of the PDF document
public static async Task AddPage()
{
const string localPdfFileName = @"C:\Samples\sample.pdf";
const string storageFileName = "sample.pdf";
const string localFolder = @"C:\Samples";
const string resultFileName = "output_add_page.pdf";
const string storageTempFolder = "YourTempFolder";
// Get your AppSid and AppSecret https://dashboard.aspose.cloud (free registration required).
var pdfApi = new PdfApi(AppSecret, AppSid);
using var file = File.OpenRead(localPdfFileName);
var uploadResult = pdfApi.UploadFile(Path.Combine(storageTempFolder, storageFileName), file);
Console.WriteLine(uploadResult.Uploaded[0]);
DocumentPagesResponse response = await pdfApi.PutAddNewPageAsync(storageFileName, folder: storageTempFolder);
if (response == null)
Console.WriteLine("PagesAdd(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("PagesAdd(): Failed to append page to the document.");
else
{
using Stream downloadStream = pdfApi.DownloadFile(Path.Combine(storageTempFolder, storageFileName));
using FileStream localStream = File.Create(Path.Combine(localFolder, resultFileName));
downloadStream.CopyTo(localStream);
Console.WriteLine("PagesAdd(): page successfully appended to the document '{0}.", resultFileName);
}
}